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

0 Members and 1 Guest are viewing this topic.

Offline danners430

  • Regular Contributor
  • *
  • Posts: 69
  • 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

  • Frequent Contributor
  • **
  • Posts: 655
  • Country: gb
  • Interested in all things green/ECO
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #1 on: May 22, 2018, 03:39:09 am »
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 danners430

  • Regular Contributor
  • *
  • Posts: 69
  • Country: gb
  • Good at overcomplication
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #2 on: May 22, 2018, 05:35:17 am »
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

 

Online james_s

  • Super Contributor
  • ***
  • Posts: 6031
  • Country: us
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #3 on: May 22, 2018, 05:49:23 am »
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 danners430

  • Regular Contributor
  • *
  • Posts: 69
  • Country: gb
  • Good at overcomplication
Re: Detecting activation of a low-side switch using a microcontroller
« Reply #4 on: May 22, 2018, 05:51:50 am »
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

Many thanks!!!

Sent from my ONEPLUS A3003 using Tapatalk

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf