Author Topic: Detecting activation of a low-side switch using a microcontroller  (Read 1012 times)

0 Members and 1 Guest are viewing this topic.

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Afternoon ladies and gents,

I'm trying to work out a way to connect a microcontroller to a DCC decoder's accessory outputs. The problem is, decoders use low-side switching of accessories, with a common positive rail. Is there a way to detect the activation of the low-side switch using the micro, or is external circuitry required?

Cheers!

Sent from my ONEPLUS A3003 using Tapatalk

 

Offline fourtytwo42

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: gb
  • Interested in all things green/ECO NOT political
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #1 on: May 21, 2018, 05:39:09 pm »
Your expecting everybody here to be a railway enthusiast then, if you want answers best not to post TLA's nobody knows! Fortunatly I know as I am a railway enthusiast!, I would imagine you will need external circuitry as the load being switched is probably supplied by a reletevly (in mpu terms) high voltage so if connected directly will blow up your mpu. For example if the load is supplied by +12V then you will need a series resistor and zener diode to limit the voltage swing to within the rateing of your mpu/micro.
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #2 on: May 21, 2018, 07:35:17 pm »
Your expecting everybody here to be a railway enthusiast then, if you want answers best not to post TLA's nobody knows! Fortunatly I know as I am a railway enthusiast!, I would imagine you will need external circuitry as the load being switched is probably supplied by a reletevly (in mpu terms) high voltage so if connected directly will blow up your mpu. For example if the load is supplied by +12V then you will need a series resistor and zener diode to limit the voltage swing to within the rateing of your mpu/micro.
The main question is actually nothing to do with railways, I just added that for context.

The main question is how to detect the switching of a low-side switch using a microcontroller, as a low-side switch obviously doesn't supply a nice +5V logic signal.

Sent from my ONEPLUS A3003 using Tapatalk

 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #3 on: May 21, 2018, 07:49:23 pm »
You could use an opto-coupler, anything that can be made to light an LED can then be interfaced to an IO pin on a microcontroller.
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #4 on: May 21, 2018, 07:51:50 pm »
You could use an opto-coupler, anything that can be made to light an LED can then be interfaced to an IO pin on a microcontroller.
That seems logical...
Seems logical enough that I'm now kicking myself for not thinking of that [emoji23][emoji23][emoji23]

Many thanks!!!

Sent from my ONEPLUS A3003 using Tapatalk

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf