Reversing an output's polarity using a microcontroller - Page 1
Forum section: electronics / beginners

author: danners430
author_rank: Regular Contributor
timestamp: September 06, 2018, 08:58:44 pm
content: Hey guys,I'm looking to control a set of points on a model railway using a microcontroller. The point motors I'm using are controlled by reversing the polarity between the two power supply terminals on the point motor. Obviously easy to do using a simple DPDT switch or a relay, but is there any other ways of achieving this?The microcontroller runs off 5V, and the point motors off 15V.Cheers guysSent from my ONEPLUS A3003 using Tapatalk

author: oPossum
author_rank: Super Contributor
timestamp: September 06, 2018, 09:02:10 pm
content: H bridge chips like the L293D. One L293D will do two motors.http://www.ti.com/lit/ds/symlink/l293.pdf

author: danners430
author_rank: Regular Contributor
timestamp: September 06, 2018, 09:11:22 pm
content: Quote from: oPossum on September 06, 2018, 09:02:10 pmThat looks sensible :-) never noticed these before! I'm guessing two things from that datasheet, firstly that they're voltage and not current driven, so the input pins can be connected directly to the MCU output, and secondly that they could also be used to drive two lead bi-colour LEDs (overkill, I know)?Sent from my ONEPLUS A3003 using Tapatalk

author: oPossum
author_rank: Super Contributor
timestamp: September 06, 2018, 09:16:02 pm
content: Yes and yes.

author: danners430
author_rank: Regular Contributor
timestamp: September 06, 2018, 09:16:38 pm
content: Perfect - many thanksQuote from: oPossum on September 06, 2018, 09:16:02 pmSent from my ONEPLUS A3003 using Tapatalk

author: tooki
author_rank: Super Contributor
timestamp: September 06, 2018, 09:21:25 pm
content: Can't one do that for bicolor LEDs just by controlling the pin modes? Isn't that what charlieplexing is based on?A bit of googling shows it really is as simple as connecting it (with current limiting resistor) between two output pins and alternating which pin is high and which is low. So one pin sources the current and the other sinks it.https://electronics.stackexchange.com/questions/334952/control-color-of-bi-color-led-using-arduino

author: danners430
author_rank: Regular Contributor
timestamp: September 06, 2018, 09:24:10 pm
content: Quote from: tooki on September 06, 2018, 09:21:25 pmAye, that's the obvious solution... However I'm working with umpteen of said LEDs, and I have a limit of 70mA output current for the entire MCU, which will really only power 3 at a time... Hence I need a way of powering them externally, using the MCU just as the switchSent from my ONEPLUS A3003 using Tapatalk

author: Zero999
author_rank: Super Contributor
timestamp: September 07, 2018, 08:09:29 am
content: There's also the SN754410.http://www.ti.com/lit/ds/symlink/sn754410.pdfThen there are more exotic ICs I've just found using Google.https://www.infineon.com/dgdl/Infineon-TLE6208_6G-DS-v01_02-en.pdf?fileId=db3a30431c48a312011c4c052072000chttps://alcom.nl/wp-content/uploads/2018/02/MPS_MP5Q6526_MP6523.pdf

author: tooki
author_rank: Super Contributor
timestamp: September 07, 2018, 09:43:26 am
content: Quote from: danners430 on September 06, 2018, 09:24:10 pmHave you considered using addressable LEDs instead? That'd be a lot cheaper than h-bridge IC's, I suspect…

author: danners430
author_rank: Regular Contributor
timestamp: September 07, 2018, 09:55:21 am
content: Quote from: tooki on September 07, 2018, 09:43:26 amI could certainly look into them... Never worked with them before, but always open to new discoveries :-) cheers for the tip!Sent from my ONEPLUS A3003 using Tapatalk

author: tooki
author_rank: Super Contributor
timestamp: September 07, 2018, 10:33:39 am
content: They're what Adafruit brands "neopixels", FYI, so lots of how-to's refer to them as that. The actual model number of the most common type is the WS2812B. They're pretty awesome. They daisy-chain (forming a physically gigantic shift register), and with the third-party arduino libraries for them, you pretty much just say "LED #[position in the chain], change to [RGB value]" and it does it. The LED itself then does the dimming/color blending on its own, with no further CPU usage, even.