Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 372
61  Using Arduino / Programming Questions / Re: Making a DC motor change directions? on: February 25, 2014, 07:15:56 pm
Hey guys, I'm working on a project that requires us to control the direction of a stepper motor...

emphasis mine...

So...which is it? A DC motor, or a stepper? You might want to figure this out, and either update your title or your post - and then maybe somebody can help you...
62  Topics / Robotics / Re: driving 3 omni wheels robot on: February 24, 2014, 07:10:28 pm
Here's an example/tutorial - not for the Arduino though:

Here's a paper detailing "holonomic control" (warning: heavy math included!):

Here's the grand-daddy of them all (Palm Pilot Robot Kit):

That should be enough to get you started - heck, that's enough information to complete such a project, if you are inclined to roll up your sleeves and aren't looking for someone to hold your hand through every step...
63  Using Arduino / Project Guidance / Re: Controlling continuous servo's on: February 24, 2014, 06:57:27 pm
Here's something to start with, perhaps:,137747.0.html

Also (mentioned in the above):

That may be enough to get you going, at least...
64  Using Arduino / Project Guidance / Re: Need your recommendation on: February 24, 2014, 06:54:32 pm
Something like this comes pretty close (minus the GPS - which you might be able to add):
65  Using Arduino / Project Guidance / Re: High Torque Servo on: February 23, 2014, 08:06:16 pm
In your block diagram, you show that you are using a BEC supplying 5 volts @ 3 amps. What I would do:

1. Use that BEC to supply the voltage to the Arduino.
2. In parallel, wire a 6 volt BEC of suitable amperage to power the servo.
Hook the 5 volt BEC output to both the servo and the UNO; the UNO would be connected via the GND pin and +5V pin:

NOTE: This bypasses the on-board voltage regulator; if the BEC does not put out a well regulated 5 VDC (or your connections are reversed), you will likely fry the Arduino in some manner (one or more components).

Most servos (check your datasheet) need 4.8 to 6.0 volts DC - the higher the voltage (within these limits), the better the servo will perform (and if you are needing high-torque, this is what you want). Some servos can operate from higher standard RC voltages (typically 7.2 and 9.6 volts) - so if your servo can use one of those levels, you may not even need the BEC for the servo. Again, check the datasheet for the servo to find out whether this is true.
66  Using Arduino / Motors, Mechanics, and Power / Re: RC car semi-propotional ; on: February 22, 2014, 10:47:42 pm
If your current car uses a motor to actuate the steering, you might try attaching a potentiometer in such a way so that the potentiometer is rotated left/right as the wheels are turned left/right. Then hook the potentiometer up to an analog input pin on the Arduino, and read it as you move the actuator.

This will only work well if you remove the "centering spring" from the steering system, and if the motor isn't geared high to make the wheels switch from left to right quickly.

Basically what you would be doing is implementing a servo function completely in software.
67  Using Arduino / Motors, Mechanics, and Power / Re: RC car semi-propotional ; on: February 22, 2014, 02:41:58 pm
For forward/back i have allready build my own H-bridge on and worked on other RC car, so i need now only to find a cheap RC with servo for direction :/

Yeah - it looks like that RC car has "bang-bang" steering; you would likely need an h-bridge to control the steering as well - or look into hacking the RC receiver; see this thread for ideas:,86883.0.html

Something like "proportional" steering could be done by pulsing the steering as you moved forward...

But I wouldn't expect to find a "low cost RC car" with a servo for steering; you would be better off getting a cheaper car, and adding your own servo to the mechanism.
68  Using Arduino / General Electronics / Re: Controlling electromagnet.for inlet timing on steam engine. on: February 22, 2014, 02:17:09 pm
There is a good reason why nobody has built a car or a steam engine using solenoids to actuate the valves -  it doesn't work !    Maybe it will work on a really slow steam engine.

It can be done for a few hundred RPM (which admittedly is slow) - all you need is something like a propane solenoid valve; 1000 RPM would probably be the top end.

There's an instructable out there that shows how to build a simple single-acting steam engine using a 2-cycle engine (like from a chainsaw or weedeater); the guy basically replaced the spark plug with the valve, plugged up the intake, and put a bicycle tire on the crankshaft for a flywheel. He then mounted a magnet to the edge of the tire, and used a reed switch to actuate the solenoid.

From the video it worked rather well; timing was changed by varying the position of the reed switch in relation to the wheel (altering when the valve opened before/after TDC). He speculated on using the magneto coil system to fire the valve as well (likely a better solution).

The only real problem I could see with the whole system was that he used compressed air to run the contraption; if you used steam, and blow-by past the rings (and heck, possibly even during the "exhaust" portion) would get into the crankcase and condense - eventually leading to contaminated oil that would turn into pudding and bring the engine to a halt. Maybe if some other kind of lubricant were used (dry or maybe liquid silicone?) it wouldn't be a big deal.
69  Community / Bar Sport / Re: whats with the attitude on: February 20, 2014, 12:19:05 pm
5) Post your code (with code tags!).  Post schematics.  If it helps, post a picture of your circuit.  Make sure those images are reasonably sized.

I want to emphasize something here on this "step".

When you post code and/or schematics (and apologies for shouting): POST YOUR OWN CODE AND YOUR OWN SCHEMATICS THAT GO WITH THE CODE.

If the code and/or schematics aren't your own - put that in your comments and where you got them from. I have no problem with someone posting someone else's code and/or schematics if they are confused about something and they haven't gotten any help from the author (provided they contacted them - if they are still around) - but it only seems fair that you give this information, since it may help us to help you, and it also is fair to the author.

Also - if the code isn't for the schematics (or vice-versa) - please indicate that; I hate seeing people post code that has nothing to do with the schematics, then asking help for either, when it is clear that they don't have a clue that neither goes with the other (nor do they seem to understand this beforehand). Worse is when they post such code or schematics, and never bother to tell where they got it from (and seem to indicate that the code is theirs - most of the time this is just a quirk of translation, though).

Honestly - I prefer to see code and schematics that go together and that were rendered by the author of the post, even if both are wildly wrong; it at least shows some initiative and willingness to learn.
70  Using Arduino / Project Guidance / Re: first robot part 2 on: February 20, 2014, 11:42:23 am
in the first part you told me to google it and i found this code (not shure that it works) now im trying to figure how to wire it.

Well - so I did - and you found the code here (you should have mentioned this in your post):

...but you can't expect to take that code (which again, I am not sure will work - even using an h-bridge control system - but I haven't rigorously inspected the code or tried it out, so I have little to base that on), randomly found, and expect it to work with another diagram on the internet you randomly find.

Just finding things on the internet won't help you - you need to also have an understanding of what is what, and how it works - before applying it to anything.

P.S im not building this robot right now im planing it first when i have all the facts then im going to build it so instead of criticizing me help me. pictures are from the net.

Yeah - I know the pictures are from the net.

The code you found in that Arduino thread appears to be meant to control two h-bridges arranged in a differentially steered robot platform configuration (similar to the video you originally posted in your first thread).

So - you are going to need to learn about h-bridges and how they are connected to the Arduino. You are also going to need to learn how PWM works on the Arduino, and which pins you can use (because I can almost guarantee that you won't necessarily find an example of using an h-bridge with two motors that is using the same pins for control as the sample code you posted) - so you can modify that sample code.

The first diagram you posted in this thread will not work because it will burn out pins in your Arduino - you need to use an h-bridge.

The second diagram you posted -could- work with the code you posted, if you updated the code to use the Servo library instead of PWM output for an h-bridge. It wouldn't be easy to do, but it could be done. To do so will require you to really understand the Servo library, how it works with servos, and how that example code you posted works with an h-bridge and PWM output to turn the motors, so you know how to update it. I can't tell you how to do this; while I could if I studied everything really closely, I am not going to do this, as I am not getting paid for such a project - just rest assured that I know it can be accomplished, if you put your mind and energies toward it.

Finally - on that second schematic - I noticed that one of the pins of the joystick lead to the TX pin on the Arduino; whether or not this would cause problems with serial comms to/from the Arduino, would depend on what pin that it is wired to on the joystick, among other factors (for what you want to do, you probably don't even need the joystick part of that circuit, since you want to do it wirelessly from your computer, right?).
71  Using Arduino / Motors, Mechanics, and Power / Re: Controlling Tank with 2ch RC Car transmitter on: February 20, 2014, 11:25:20 am
If I am correct, and i just looked at the pulsein() function reference, that only reads the HIGH and LOW value of the receiver because you are using the digital pin to have essentially an "on" or "off" value as you stated.

A standard hobby-grade R/C receiver outputs a PPM waveform meant for a servo; in other words, this waveform is what a servo uses to position itself (it's like PWM - but it is -not- PWM - only similar). The pulseIn() function can read this PPM signal, and convert it to a numeric value (in microseconds).

This value could then be used to write directly to the servos (if wanted) via the Servo library function writeMicroseconds() - but this can't be used in the case of a "steering wheel" style 2-channel controller for obvious reasons (if the channels were instead mapped to two forward/backward joysticks - one for left-thumb, one for right-thumb - it would be a different matter).

But, to accomplish the variable speeds of the forward, and later backward, movement, wouldn't I have to use the analog pins to get a varying speed thus creating the increasing and decreasing speeds?

Ultimately you would be using the Servo library, if you are using R/C ESCs to control the motors - so you can use any pin on the Arduino for that (you aren't limited to PWM pins for the Servo library). Now - if you were using an h-bridge, and the standard PWM output - yes, you would need to use a PWM pin for each channel (motor) of the h-bridge, but you indicated in your first post that you were using an R/C ESC to control each motor, not an h-bridge. It should also be noted, though, that there is a "SoftPWM" library out there to allow you to control any pin in a PWM fashion (it works in a similar manner to the Servo library - taking over a timer interrupt to generate the PWM waveforms).

Also, isn't the writeMicroseconds() function to set the servo on the tank to a certain angle or can it to be used to read the input of the steering wheel of the transmitter?

I indicated that particular function in order to show that the "center" PPM value that is output from the receiver is 1500us, I wasn't meaning to imply that you use it for reading (as if the name of the function wasn't clear enough?).

or do you have to use the pulsein() function and the writeMicroseconds() function in conjunction with each other to accomplish this goal? I am definitely missing something...

Yes - you read from the receiver using pulseIn() the value of the PPM number of microseconds, then you use that value to decide/control the output to the servos (or in your case, the ESCs) using writeMicroseconds().

With parts 3 and 4 of this little idea of the function if I am reading this correctly is saying that if the wheel is turned in either direction it will turn in an arc formation if that makes sense but still a fixed arc formation with the wanted variable speeds still in play. So with that will we just have to read the outputs of the receiver and then patch them into a variable speed to make it turn at different rates in different arcs depending on how much the receiver is actually turned?

In short, yes. It is actually a bit more difficult - because the speed of your motors (to operate the treads) and turn properly will depend not just on how far right or left your steering wheel is, but also how far forward or backward the trigger is as well - so you have to integrate them together in some manner. Likely, that manner isn't very difficult (I would try taking the value from the forward/reverse and mapping it to something smaller, then using that to multiply/divide the left/right values then re-mapping them to 0-1023 to keep them in range).

Thanks so much for the feedback! and even more would be appreciated.

Good luck - your best bet is to put something together, and try it out to see what you get (you may want to mount your vehicle up on blocks first while experimenting). Something else to keep in mind (unless you are already aware of this) - most R/C ESCs will require some kind of "arming sequence" before they will control your motors - so you'll need a function to something to send the proper commands for this (which vary depending on the ESC - read the manual for the ESC to find this out).

Finally, some 2-channel R/C controllers of the "trigger/wheel" combo you describe have the "midpoint" of the trigger set not in the "middle" (1500us), but somewhere else. Sometimes this can be altered (check the manual for your R/C controller) - other times it can't. Just keep it in mind - you may want to set your code up initially to dump the values it reads to the serial port so you can monitor what your controller is actually sending to the Arduino...
72  Using Arduino / Project Guidance / Re: first robot part 2 on: February 20, 2014, 11:00:03 am
First off, that code looks "iffy" to me, mainly because the comments seem a bit off; the comments show the x-potentiometer and the y-potentiometer arranged as would be expected, but further comments talk about the x-potentiometer pins controlling forwards/backwards movement and the y-potentiometer pins controlling left/right movement. Furthermore, the PWM outputs seem like they wouldn't match up to what the controls are meant for.

All that said, I haven't explored it too in-depth to really know what is going on, other than I can see that the code was meant for h-bridge control of two motors (likely differential steering arrangement - but then again, not sure!), not for controlling servos as in your second diagram (heck, the pin assignments don't even match up).

The fact that you have posted a piece of code and two different diagrams that are either wrong or won't work with that piece of code, and the fact that you are unable to see this, leads me to believe you are just pulling random bits of junk from the internet and hoping some of it will somehow work together - without being able to understand how and why it will or won't work together.

If you wrote the code you originally posted, you would know that it was meant to control an h-bridge, and you would have indicated this on your diagram. You would have also known that it wouldn't work with a servo, which you show on your second diagram.

Either you didn't write the code or draw the diagrams, or you are really confused about how everything is supposed to work in regards to this project...
73  Using Arduino / Motors, Mechanics, and Power / Re: Controlling Tank with 2ch RC Car transmitter on: February 19, 2014, 02:48:20 pm
Super nooby to arduino but I was wondering would it be possible with arduino to control 2 individual motors with a 2ch rc car transmitter?

Yes, this can be done.

My idea is this, the "trigger" on the transmitter controls both motors and powers them with the same value forward or back like most RC transmitters work, controlling the speed of course varying on how much you have the trigger pressed.

Ok - so basically what you're going to do is use a tight loop, and read the output of the receiver via a digital input pin using the pulseIn() function:

Likely (but I am not certain - you will need to experiment) - the center point on the trigger and on the steering "wheel" should be a pulsetrain of 1500us - see:

So - when the trigger is "at rest" and the steering wheel is centered, both should be outputting around 1500us when read with pulseIn(). Note that this won't necessarily be exact - so you will need to take this into account; I am not going to do this in my notes below, though - but keep it in mind.

So - for the trigger - you could just write (in the loop) something like:

1. Read using pulseIn() from the pin for the channel for the trigger.
2. If the value read is > 1500us then call the function for moving forward.
3. If the value read is < 1500us then call the function for moving backward.

That basically handles the trigger part.

But then would it be possible with the arduino to take the outputs from the transmitters receiver and input them into the arduino which then controls the motors but also is running code that is inputting the outputs of the turning wheel on the transmitter and feeding them to the same esc that is controlling the motors to essentially "brake" either of the tracks to turn left or right?

Ok - so let's just deal with the "moving forward" part - because the reverse will be similar anyhow.

So - in that function - you would basically:

1. Read using pulseIn() from the pin for the channel for the steering wheel.
2. If the value read is 1500us, then call the function to apply equal values to both ESCs/motors (left and right).
3. If the value read is > 1500us then call the function to apply a larger value to the right ESC/motor and lower value to the left.
4. If the value read is < 1500us then call the function to apply a larger value to the left ESC/motor and a lower value to the right.

...and that's basically it.

Now - the above is basically a "fixed speed" thing; to make it more proportional, you would want to pass in the value read from the trigger into the function for the steering, then use that value along with the value from the steering (likely using the map() function in some manner) to apply varying values to the ESCs/motors.
74  Using Arduino / General Electronics / Re: Finding motors requested Voltage! on: February 19, 2014, 02:22:10 pm
Most toy motors operate on voltages from 3 volts to 6 volts - but you didn't say what kind of toys you pulled them from, nor the age of those toys; if you could post some pictures of the motors, that could help us give better information.

Also - some toy motors will have information about the motor (part number and manufacturer, mainly) stamped on the plastic end-bell where the wires enter. See if you can take clear photos of that area as well.

The only motors you will likely see from toys that take more than 6 volts will be those meant for higher-quality toy RC cars; some of those motors will be low-quality 7.2 and 9.6 RC style motors (not hobby grade, but still fairly nice compared to other toy motors). These type motors will usually have cooling slots toward the end-bell housing thru which you can see the brushes and/or commutator. The end-bell may have the brushes (or spring holders) visible as well. The motors will tend to be larger, heavier, and will "cog" as you turn the shafts.
75  Using Arduino / General Electronics / Re: Question about Vehicle Electrical system and electronics on: February 19, 2014, 02:14:43 pm
The Atmel site has a ton of documentation on automotive circuits, but one that you might find helpful is this one:

"AVR040: EMC Design Considerations"

It will at least give you enough information so that you can make a robust power supply for an automotive environment; I should also note that Atmel makes automotive-grade versions of the microcontrollers used by the Arduino platform - these might be worth looking into as well.
Pages: 1 ... 3 4 [5] 6 7 ... 372