Go Down

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

Boardburner2

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."



Your friend is correct perhaps he can explain.
As asked post a diagram of your idea and we can say why its wrong.

Boardburner2

OP
Try drawing it out.

An open collector 'collects' current not volts.


Consider when it is switched off though what happens to the terminal voltage at  the arduino output pin?


A voltage divider divides volts what you are trying to do is 'divide' current.

Paulcet

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."

That's it.  You are missing some obvious principles of electronics.  Not that I am putting you down.  Asking questions is a good thing, but we don't have time to teach you electronics 101.  Many of the people helping here have studied/practiced electronics for years and the reasons not to use a voltage divider in this application are obvious to us.  

raschemmel

You have your answer. Are you trying to avoid it?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

DrAzzy

But I am still curious why voltage divider should not be used in this case.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."


What you're missing is Ohm's law. There are three variables in there, voltage, resistance AND CURRENT.
There is no voltage drop across a resistor unless there is current flowing (that's the issue in whatever Tom was envisioning). And any change in the current flowing will change the voltage drop.

Voltage dividers only work when the current across the two legs of the voltage divider is equal (so you can't be driving a load, or sourcing or sinking any current in the middle - all you can be doing is measuring that voltage, pretty much) - otherwise the voltage at the middle of the divider will change. That's why you normally use it for inputs - an analog input involves negligible current, so it's fine to divide the voltage down, and analog inputs need analog voltages.

You can't use it for powering things, because that load will throw things off.

And you can't use it to control things, like you're suggesting.
How are you even proposing to connect it? I can think of at least three ways, but they're all various shades of wrong, and if you draw them out and look at ohm's law...

So yeah, you need transistors of some sort for this!
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

raschemmel

My "Noobie" instinct tells me your plan is to combine a voltage divider with a digital output pin set to LOW (to sink the current coming from the voltage divider).

My response to this is that if you have a meter (which you do) , and know how to measure voltage,
(which you do) and current , (which you do), then WHY do you need to post ?
Isn't it a simple matter of measuring the current from the voltage divider node to ground , and then reconfiguring the meter to measure voltage and measuring the voltage on the divider tap off point and comparing those values to the know maximum allowable values (ie: 5V/40 mA) ?
If the measurements are within spec , what do you need us for ? What could we tell you that you don't already know ? You seem to already be aware of the transistor option, but have yet to make a decision. What are you waiting for ? Either proceed with the above, or go to Plan-B (transistors).
So far you have not made up your mind to do that because you haven't even asked us how to wire the transistors, and if you don't even know Ohm's Law, what's the chance you know how to wire transistors. If you knew how to use Google, this project would have been put to bed a long time ago.
Do you have any idea how many links there are on Google with a search for "arduino driving transistors " or "arduino driving open collector transistors" or "Ohm's Law" ?
Welcome to the forum, now  Do something.

FYI,
In case you haven't figured it out, my role here is "bad cop"... ;D
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

dwightthinker

With a voltage divider you'd get two speeds,
slow and slower.
How slow would depend on the resistors used.
There would be no off and no full speed.
What is wrong with using inverted outputs?
It is just code.
Instead of 0 is on and 1 is off,
you'd use 1 on and 0 is off.
rant on:
I see the example of using a switch with a pull
down resistor just so the code would be high is
pressed. That is just silly when using a grounded
switch eliminates the need for the resistor using
the input pullup mode.
rant off:
Dwight

raschemmel

Quote
Figured out 4 lines of control in the original control board using which I can control the motors. 
Just for the record, we do NOT know WHAT the 4 signals are.
Almost any wild guess, would be wrong. Some hackers out there may actually know . Without knowing what the signals are or HOW they work, isn't this entire discussion ACADEMIC ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ajan

@DrAzzy

Thanks DrAzzy for trying to explain the flaw in using voltage divider as a solution here.

ma
That's it.  You are missing some obvious principles of electronics.  Not that I am putting you down.  Asking questions is a good thing, but we don't have time to teach you electronics 101.  Many of the people helping here have studied/practiced electronics for years and the reasons not to use a voltage divider in this application are obvious to us. 
@Paulcet
I think  you do not know how to explain what "obvious principles" I am missing here :-) .

@raschemmel

Appreciate your time and thanks for posting replies , especially the suggestion on using relay switches instead of transistors.

In your replies you are suspicious on if  I understood the "open collector " solution. I do not want to quote from my original post again to prove that.  The question on Voltage divider was there not because , I did not know ( or I did know) transistor wiring , but I was not sure why voltage divider should not work.

@raschemmel
I do not know what signals are there from those control points. I just measured voltage between the point and the ground. Also measured the current when directly sinking to the ground. (When directly sinking one point to the ground I got one side motors working.) I do not have a scope to check the signals.
By "academic" , I do not have a real project in hand ? No.. I have some thing solid before me.
Or did you mean .. that discussion is going too theoretical ? .. sorry I cant help ;-) asking questions.


@dwightthinker
I am yet to digest your answer.


This is my first post. I posted this yesterday. I did not get time to "do" things today.  Thanks for the overwhelming support and information. Will keep you posted.
By the way I am posting the diagram to clarify the voltage divider I was "thinking" about. ( Those who have clarified undoubtedly that VD is not the solution , please excuse me).

raschemmel

By "academic" , I mean that until you post a "working" Truth Table for the four signals/nodes it makes no difference what method you use to ground them.
"working" means a truth table that explains how to get both side motors working , forward and reverse.



"one side motors working" does not a working RC car make.

I think you lack the electronics experience to appreciate the situation you are in. What we think is irrelevant if you able to get it working. There are certain things that are irrefutable, like , for instance,
that a 9V PP3 smoke alarm battery is rated for 350 to 500 mAh, meaning that if the motors draw 100 mA when running , the battery would only last a few hours. If they draw 350 mA, it would only last one hour , and so forth. Aside from that, we are helpless because you have told us next to nothing, and you have discovered only partial information, meaning, you only have one side working, and , if I understand you correctly, you have no idea what relationship exists between any of the four signals/nodes you refer to. You could, at any moment, stumble on something that enlightens you as to how to make everything work. You say that these points draw 1 to 5 mA with no resistors. We don't know if you know Ohm's Law but my guess is you don't, so you do not realize how inserting 1000 ohms of resistance in the signal path of a signal that is designed to connect directly to ground will effect the operation of the circuit, which , for all practical purposes is completely unknown. We , (including you), have no idea what circuitry is on that board. I have seen people completely reverse engineer RC toys and design a uP interface that works. You have not yet demonstrated such hardware hacking skills. Whether or not the voltage divider would work is irrelevant until you figure out how to get the circuit fully functional. If you had started your post with a close up photo of the board , showing the four nodes, and the traces, we might have reverse engineered it by now. I fail to see how having only one side motor working gets you any closer to getting the thing working , unless you are content to watch it run in circles. You need to make a lot more progress before this post is going to go anywhere. You said you know how to wire open collector transistors. How about posting the math for calculating the base resistor. Show your work. Link the datasheet.   It would have taken fewer characters to give an example Base resistor calculation for an Open Collector transistor than it did to say "you think I don't  know how to use open collector transistors but I do..."




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

Paul__B

Without knowing what the signals are or HOW they work, isn't this entire discussion ACADEMIC ?
Quite so.

Don't just complain. Provide a compelling alternative.
Dead easy, and should be the first thing that comes to mind - the TPIC6B595 (or in this case, TPIC6C595 would be sufficient, but the "B" is likely the most readily available).

This uses FETs as the ("open drain") switching elements with a very low saturation voltage, and uses a fraction of a milliamp supply current making it suitable for battery powered devices.  Like the ULN devices, it contains "kickback" protection but does not require a connection to the supply rail of the switched devices.

Now of course, it is in fact a shift register and latch controlling these eight output FETs.  This is hardly a disadvantage; it means you control it - or many of them chained - with only three microcontroller ports and could thus be paired with one of the low lead-count devices.  You can either "bit-bang" at maximum speed, or use SPI functions.  Since almost all applications of the ULN drivers are low-speed (they have to be, the first transistor in the Darlington saturates), the slower performance of using a shift register is moot.

raschemmel

This is a good example of what I meant.
Here the poster (Paul) is assuming the four nodes/points/signals are used to sink motor current (due to the almost.non-existent intel)
This is evident by the reference to "kick back diodes" which go in parallel with an inductive load, such as a motor.
I on the other hand think those points are inputs of a chip , and NOT connected to the load. Paul's suggestion hints at a smarter solution though, which is  "screw the onboard circuit " and just cut the motor wires and add your own custom circuit, designed from the ground up ( no pun intended) and be done with it. Then you don't have to.worry about those four points anymore. There is only one reason this has not already been done and Paul knows what I am talking about.
@Paul,
Would you care to explain WHY  the OP has NOT done this and is still screwing around with the four bloody "points" (for lack of a better name for them) ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Paul__B

Me?

How would I know what is in his mind? :smiley-eek:

Without the pictures we have requested (haven't we?  Can't imagine why not!), we don't quite know the situation, but he did suggest these control points have 9 V open circuit and 5 mA short circuit.

My point is that whilst the TPIC6B595 outputs are capable of sinking much more than 5 mA, they really do not care how low the current is and have negligible leakage when turned off, so will be as appropriate in this situation as any other.

raschemmel

The reason the OP hasn't opted for a redesign is that it requires prototyping skills, as opposed to simply grounding 4 wires.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Paulcet

@Paulcet
I think  you do not know how to explain what "obvious principles" I am missing here :-) .

You have a point.  I don't have enough time to explain them here.  I could teach them (and have) in a classroom with a lab.

I suggest that you do some reading.  Google "online electronics course".  http://www.electronicstheory.com/ has 75 pages of introduction to electronics and that is just the beginning!  Or better yet, take an electronics course at a school with a lab!

Go Up