I am working on a Useless Machine. Almost everything is going fine. I found a code to use with it. I can connect the arduino uno to a breadboard and the two servos to that without a switch and the servos move like they're supposed to moving from on action in the sketch to the next, then it starts all over. I can put the switch in the loop and turn the power on and off, which restarts the sketch at the beginning every time I turn the switch on.
I don't have the servos set up in the box yet so there isn't a hand shutting the switch off. I tried to do that myself but every time the sketch just starts over.
The problem I am having is getting the switch connected to a pin (#2) to run the sketch like it's supposed to. I used a 10k resister in the setup. Some how I don't think I am wiring the switch right to the pin.
I have looked at a lot of videos and schematics but can't figure it out.
This is usually done without an mcu, just a battery, switch, motor, and return spring. The switch comes on, starting the motor that advances against the return spring until it hits the switch, stopping the motor and allowing the return spring to reset to 1st position.
I have built a couple of these, similar, not identical, and some of the construction can be a little fiddly.
Show photos of what you have in front of you there and include any power supply/battery pack you are using.
Draw a sketch of the circuit, pencil and paper is ok, and include the sketch here that you uploaded using the code tags.
People are not going to chase all over and download programs etc. to help you.
Best you provide everything you can right here.
I tried a 6v AA battery supply and it made the motors jitter and sound like the gears were going to break apart. I used different pins for the motors on the Uno and I got the same thing. I tested these motors on a 8 servo tester and they work fine. They run without jittering using the Uno as the power.
As also mentioned previously, just be aware the sg90 has an upper limit of 6V.
5x AA (dry)as you mentioned before will be just under 8.0v fresh.
Similar for fully charged NiMh cells.
Breadboards are notorious for giving poor servo power as they are simply not made for larger currents.
I was using 4 AA standard rechargeable batteries @ 1.2v which is 4.8v. I thought the batteries were 1.5v. So I just switched to 4 AA non-rechargeable batteries @ 1.5v and it seemed to work better, faster and stronger.
I need to order some 3v or 1.5v rechargeable AA batteries now.
Also I was just watching the progression of the sketch in the serial monitor. I kept turning the battery power off and back on (unplugging and plugging in the battery pack) and the sketch didn't reset each time. It continued on from one action to the next like it would if the switch was hooked up. That's progress. Now I need to get the switch hooked up and the project put in the test box with an arm and a switch to test the whole thing.
Edit: Actually, after looking on the internet I decided to go with a 5 AA battery holder. 5 x 1.2v = 6v.
Thanks, I'll check into it. I need to know about all that stuff.
Meanwhile I found my universal power supply (wall wart) and set it to 6v. I tried it and after I put a better tip on it it worked fine. I will figure out a battery pack later.
So now my question is how do you use batteries that have a higher voltage when they are fully charged than they are rated for. Especially with something like the servo motors I am using that have such a small range of volts they can use. It doesn't make sense to use batteries for things to me. I don't have to have batteries inside the useless machine, it's just a learning project for me.
I probably need to start a thread about this, unless someone can point me to some info on this.
Well I got my 4 AA battery holder back out and checked the voltage on it with rechargeable 1.2v batteries and the 5 battery holder at 1.2v. I got 6.5 with the 5 batteries and 5.2 with the 4 so I am going with the 4. I checked each of the 1.2 batteries and they all read 1.30v.
.........AND if you checked details on Batteryuniversity you might begin to understand why.
0.8,1.2, 1.3 or fully charged at 1.45 possible.
Point being 4AA dry cells will run the thing for donkey's ages.
mmm..that reminds me, must check the battery in the one I made for the kids up in Thailand before Covid struck and stopped us travelling.
Probably leaked everywhere by now........