Ah I see so the only way to get it to work now is either to connect the servo to another power source or to get an all-new servo that only requires 500ma of starting current?
Maybe but will a tiny servo be strong enough to do what you want?
Also I don’t understand how other programs like sweep.ino example code are running fine when in the 5V pin if the power source isn’t drawing enough current for the servo to move properly
Sweep only moves 1 degree at a time so depending on the servo it may not draw a lot of current when making small steps. However, unless you can measure the current and confirm that is indeed the case, don't connect it to the 5V output.
If you mean in response to
that you changed it, that would have absolutely no effect on the code.
So what did you do that did fix it? Did you replace delay with something?
a7
I replaced it with an unsigned long like jim-p suggested
I used the code from the sweep to increment the moving in and moving out and it's working perfectly (except for the print statements being wonky). Gonna set it to 8 hours and I think that's it. Thank you for your help!
If you plan to operate this from batteries you will need the 4AAs for the servo and a 9V for the arduino
Ok, please try what you had originally, and if that breaks your sketch, post it in its entirety.
a7
Yeah you might have been right. I tried it with just the 9V battery and it didn’t last 8 hours before my servo started jittering like crazy. Guess it’s time to invest into a battery pack ![]()
But if I use the battery pack for the servo will it still not drain battery life when in power down mode?
You are right, I did not consider that and it could be a couple of milliamps. So we need to cut power to the servo motor when the Arduino goes to sleep.
You have two choices build something or buy one of these
Would using a solar powered battery fix this?
I don’t know if I can fixate mutliple components into my build
You would need even more components. Solar panel and probably at least one buck/boot converter and a battery charger.
Hmm yeah you’re right I guess I’ll cancel my order on those but how does that thing you sent work? Will it keep the servo in line with the sleeping of the arduino?
I already ordered a mini solar panel and a rechargeable battery usb-c but if this is a better option I guess I’ll get it instead
The Uno R3 still consums a lot of current even when it is sleeping because the LED and the USB-TTL are always on. If you really want to save power a pro mini would be better.
You stiil need this circuit in either case. When you wake up, just set the ON/OFF pin HIGH, it will automatically go LOW when you go to sleep.
So hook up the on/off pin of the component to a pin on the arduino? I am considering investing in the pro mini which I honestly should have done from the start but I didn’t really know much about the models. However it’s a bit odd because right now I have the arduino wrapped in a cover taped up with the battery and all while the servo is resting up and I’m not sure where I’d place the mini if not on a breadboard. (I’ll attach a picture cause my describing isn’t really well).
This is where the circuit was (I disconnected it). I also attached a picture of the servo motor wire path and how it looks when fully wrapped and covered (I have to use mostly recyclable materials for this project so that’s why it’s a little shabby). The wires of the servo are connected to DuPont cables and those go through the pipe to where the rest of the circuit is.
And just to clarify the mini would still be connected to a battery if it’s own right?
Also how would you connect a battery (if that’s still what I’m supposed to use here) to the pro mini? A would a female-male cable with a battery pack work?
Yes and don't forget the GND connection.I fyou buy the pro mini you also need to buy a USB-TTL board.
This explains how to use it
https://learn.sparkfun.com/tutorials/using-the-arduino-pro-mini-33v




