lm339 and bit of fun with accelerometer - Page 1
Forum section: electronics / projects

author: Greg J
author_rank: Regular Contributor
timestamp: December 24, 2011, 10:04:20 pm
content: I am preparing bits for my robot, and one of the things I wanted to toy with is robot drive, and accelerometers.I am software engineer (I know, booooo), but I started as a young electronics guy. So I like to develop electronic bits the same way I approach software.In small, manageable bits that I can test, and toy with - before putting together full design.Here's a simple schematic of one of the parts, the idea is that if the probed voltage is below half point, one LED will be on, otherwise second one will be on.This will then drive H motor driver, and will see if it will work.Here's the schematic of it:Anywaaise, here's videoPlease let me know what you think, throw any comments - common sense applies of course.But I am very interested to know what you think. Like I said, I'm software guy by day - wanna learn more about electronics by evenings.

author: Greg J
author_rank: Regular Contributor
timestamp: December 25, 2011, 12:09:53 am
content: playing with it some more, I've added h-bridge with engine like so:This is suppose to be driven by where LEDs are in my LM339 schematic. But it only works for the first LED, the second one doesn't drive anything.Where did I go wrong, and how can I fix that? Any ideas please ?

author: Greg J
author_rank: Regular Contributor
timestamp: December 25, 2011, 09:36:07 pm
content: Thanks for the massive amount of help! Really helpful this silence , no kidding !I've managed to get it working. Now it just drives h-bridge.But it turned out my drive does;'t have the torque to drive the robot and keep it balanced. Doh ! Someone shoot me please, for not thinking about it.See it yourself, pretty pathetic !Also, now I think I'll need to oompff the power on this thing, proper dc motor with some gearbox that'll have enough torque is 12V , I think (correct me if I'm wrong of course).Here's new schematic for the complete thing (without accelerator, but you get the idea).Again, comments are welcomed. Seriously!

author: Neganur
author_rank: Unknown
timestamp: December 26, 2011, 08:22:24 pm
content: Quote from: Greg J on December 25, 2011, 09:36:07 pmIt's Christmas. I for one am busy with family, sauna and beer.Why is Q1 not a BC547 as well?I would place a pull-down resistor at the non-inverting input of IC3.

author: Greg J
author_rank: Regular Contributor
timestamp: December 27, 2011, 02:09:39 pm
content: Because I didn't have another one aroundI used whatever I had in drawers, and whatever maplin had in stock. (and they are usually having 1-2 transistors of each type, if any, absolute joke!)Now, I might actually ditch that transistor all together and just end up using two 741. Because the idea is to have H-bridge drive motor one or the other way depending on the input voltage. When its below 1/2 Vcc, one way, above - the other way. Will it work? is a different matter, but I'll save quite few transistors if that's the case.Since my motor turned out to be crap, I want to try 2x 1.5v-3v motors with 1:100 gear, loads of torque ! But they're heavy , and need shit loads of current (0.35A on 3V each !).I need two massive h-bridges. But designing an h-bridge is subject for another thread

author: Berni
author_rank: Super Contributor
timestamp: December 27, 2011, 02:24:32 pm
content: Well 0.35A is not that much, you can try getting a L298 H bridge IC, it can handle amps of current.Also from the video the motors look quite slow for a balancing robot, You mainly need fast motors so it can correct it before it leans too much And as with most fast and sensitive regulations you will likely need some resistors and caps in feedback loops to tune the response of the regulator. I saw someone make a balancing robot using a 555 timer so you like try looking at that for ideas

author: Greg J
author_rank: Regular Contributor
timestamp: December 27, 2011, 04:28:58 pm
content: its 0.35A under pretty much no load. Under load its going up to about 0.6, and I can stop it with pliers (impossible with fingers).When stopped with pliers it draws about 1A, so that might be something to watch out for. If I had to design the h-bridge myself, I would probably have some cut-off protection once current draw goes over certain amount.I'll try IC h-bridges first, as footprint does matter in this case. As far as motors go, this one with 1:100 gearbox should still be fast enough.L298 H won't work in my case, because the motor is 3V. I'm guessing I'll have to hack together my own one.But from my few tests I can see that torque is pretty much the most important thing. After all it needs to be able to lift the whole thing.Speed is important too, but that can be cured with voltage. Motor is 1.5V-3V, so I reckon I could get away with 3.3 or even 3.6V if need be, to make it faster.I hope I won't have to buy other motors, cos these were quite expensive (£12 each). The motors are MFA 918D1001/1.The motors on the video are from a cheap toy, weren't worth the money !

author: Greg J
author_rank: Regular Contributor
timestamp: December 27, 2011, 11:41:13 pm
content: So I've simplified my circuit greatly, by utilising just the LM339 and what's inside of it !. Good stuffNow it fits on a single bread-board (with the accelerometer board), yay!Ordered h-bridge IC, because even in darlington setup bc558/547 can't drive my two big motors.For some reason I couldn't get 741s to invert output of LM339, hence the drive to simplify the circuit.I have to practice op-amps a bit more, I haven't used them much.Btw Berni, you've mention someone using 555 to drive self balancing robot - can you point me in direction of some website, design, email, etc ?and I think I need to find analog gyro. I think ST have a chip that does that, but suckers don't like to support small businesses and refuse to send me samples. Bunch of ^£%&@£$%, so I'll try avoid their parts. Any suggestion on that ?

author: Berni
author_rank: Super Contributor
timestamp: December 27, 2011, 11:50:08 pm
content: Here is the 555 timer balancing robot i talked about:

author: Greg J
author_rank: Regular Contributor
timestamp: December 28, 2011, 12:27:12 am
content: Wow, that is great. It shows how that sort of thing can be done in analog circuit. Pure geniusI got few photoresistors and 556s lying around - might play with thatThese days people are just throwing in uC, and driving things that way. But I want to use uC for other stuff - and have as much drive control in analog circuit as possible.And I'm a software guy, so doing stuff on uC is just too easy. No fun

author: Greg J
author_rank: Regular Contributor
timestamp: December 31, 2011, 10:03:24 pm
content: Finally got a proper h-bridge (L298N) hooked up.There's been some difficulties getting 741 to behave like a buffering op amp (subject for another video, which I'll post here as a question to all of you knowledgable folk).And yes, I'm planning to get a proper camera.Thanks !