Go Down

Topic: Sinking current - How to pull down a point to zero using Arduino pins (Read 4251 times) previous topic - next topic

Ajan


I was trying modify  an RC car control using Arduino. Figured out 4 lines of control in the original control board using which I can control the motors.

These lines/points need to be earthed/connected to ground  in order to activate an action.
eg; point 1 needs to be earthed to get the motor to go forward. and so on.

It would have been easy if it just needed a digital high to get invoked.But they need to be sinked.

I know Arduino digital pins can sink when they are low,  up to some 20mA.Measured the sink current and it was some 1-5 mA only. ( Connecting the multimeter in series
with ground and the points)

So far good.

But when I measured the voltage between ground and these points , it was around some 9 V.
I think arduino pins cannot handle above 5 V even in low currents.( NOT SURE).


One way to get this done is to use transistors on each line , enabling the grounding by digital highs at base.

Is there any other way without using transistors? A voltage divider will work?




Boardburner2

When using an arduino as a sink it is important that the scource voltage is not above the supply to the arduino either 5 V or 3.3.
You need to use an external transistor or you risk destroying you arduino.

You need to post a circuit diagram.

Boardburner2

Is there any other way without using transistors? A voltage divider will work?




Possibly , you may need zeners though, a simple transistor is probably the easiest approach.

MarkT

Is there any other way without using transistors? A voltage divider will work?
No, but you can use transistors packaged up conveniently in an IC like the ULN2803.
8 channels and handles higher voltages.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

pwillard

There are compelling reasons to consider using transistors.

1) A $0.20 transistor is cheaper than a $3 AVR chip
2) Transistor array *driver* chips are really inexpensive.
3) The solution here screams "open collector", which is  what you get with ULN2003 or discrete NPN transistors.  The wiki explains it all.  Open_collector
4) Voltage dividers are not magical and have some real draw backs in general but in my opinion definitely  doesn't belong in this solution.

I urge you to consider using a transistor to do the muscle work and keep your AVR signal pins sending signals to "perform" heavy lifting to parts designed to do so.

raschemmel

Quote
The solution here screams "open collector"  
Of course all of us with 20 years or more electronics experience know what you mean and have experienced that feeling but I don't think the OP appreciates that comment as much as the rest of us. A low tech option for people who should never be seen with a soldering iron in their hand (because of the disaster that would result: see photo)





is a small arduino friendly 5V relay board that can be easily interfaced with jumpers. They come in the 4-relay variety.
4-relay module
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Paul__B


raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

pwillard

Quote
Oh please!

Don't advise people to use ULN2003/ 2803!
Don't just complain. Provide a compelling alternative.

Ajan

Thank you all for the responses.
I'm convinced that transistors are the best option.

@Paul__B
Oh please!

Don't advise people to use ULN2003/ 2803!

Can you please explain why  transistor arrayULN2003/2803 are not good options?




4) Voltage dividers are not magical and have some real draw backs in general but in my opinion definitely  doesn't belong in this solution.

I tried using two 1K resistors to divide voltage and tried on another control board
which has 2.9 V sink voltage.I got 1.5 V at arduino pin to sink and it worked good.

My friend Tom suggested this about using voltage dividers:
"I thought about that, but when you're not driving the pin, it'll be at 9V, so you might blow up the ATmega chip."

Can you people share your thoughts about using advantages/disadvantages of using voltage divider in this context?


Paulcet

A voltage divider is to be used on an INPUT.  The voltage divider happens to be an easy and effective level-shifter, but it has drawbacks due to its simplicity.  In this context (5V device output), it is not a "level-shifter".

raschemmel

Quote
Is there any other way without using transistors? A voltage divider will work?
Short answer, NO. Voltage dividers won't work.



The OP stated he needs to sink current by pulling four nodes to GND.
As ALREADY stated, this application SCREAMS OPEN COLLECTOR.

@OP,
Do you understand what "open collector" means ?
If not, please say so, so we can bring you up to speed on that.
(or you could just Google it, if you chose to)

On another note, it would be NICE if we knew HOW MUCH current needs to be sinked ? (I want to say "SUNK", but in 30 years of electronics , I don't recall hearing that used in this context.


Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ajan

Thanks again for the valuable inputs.

"One way to get this done is to use transistors on each line , enabling the grounding by digital highs at base.
Is there any other way without using transistors? A voltage divider will work?"
I have mentioned already in the original post about the use of transistors and hinted the open collector configuration, as solution. Though I did not use the term ope collector.( in the above quote)

Also I have mentioned the current in the original post, 1 to 5 mA.( I got this by connecting the multimeter between ( in series) with ground and the control points)

I appreciate you all reaffirming the use of transistors as a solution.


But I am still curious why voltage divider should not be used in this case.
A voltage divider is to be used on an INPUT.  The voltage divider happens to be an easy and effective level-shifter, but it has drawbacks due to its simplicity.  In this context (5V device output), it is not a "level-shifter".
I did not understand this comment.

"voltage divider is to be used on an INPUT" -  Why not in output , for sinking - in this context?
"but it has drawbacks due to its simplicity" - What are the draw backs?


Either I am missing some obvious principles of electronics/electricity. My intuition says- do not use voltage divider . But my brain questions it . Please help.

My friend Tom suggested this about using voltage dividers:
"I thought about that, but when you're not driving the pin, it'll be at 9V, so you might blow up the ATmega chip."



DrAzzy

For low current, ULN2x03's are acceptable. I use them routinely myself. But only when I'm dealing with a small load, not when I have to switch any significant amount of current.

If you've got a bunch of things that are getting pulled up to 9v, but you only need to sink a few mA from to pull to ground, the 2003/2803 would IMO be a pretty good option. They don't pull all the way down to zero - it goes to like 1-1.4v IIRC, depending on load - that's probably low enough for the device in question to recognize it as low, which is all you need (since as you've said, the current you need to sink is <5mA - so that means this is just the input for something that then controls the motor)
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

raschemmel

Voltage dividers, unlike transistors, are not controllable. I assumed you needed to be able to control the current sinking nodes. If not, why not just jumper them to ground ? Why would you need to post if you didn't need control of the sinking ? You simply jumper them directly to ground and be done with it.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up