NOOB HELP -Arduino cat feeder -Servo & RTC

arduino

#1

Hi Folks,

I am looking to put together a cat feeder for my cat who is able to get into all commercial units, my fiancé asked me to put one together and I thought “what a great opportunity to learn about Arduino”. As I have absolutely no experience in electronics (even in school 16ish years ago, I was excluded because of being colour blind so was given essentially a lego kit to assemble). However I would like to be able to store and read data from my green house and other areas of my home potentially in the future. The one constraint is the project needs to be ready to use in about 2 weeks, to allow some testing time to fine tune it, that includes construction of the prototype.

So far I have purchased the Jaycar duinotech experiments kit, with an UNO R3 (type) board and some peripherals to start experimenting. It turns out to be a lot harder than I expected (I’m sure you’ve heard that before), even though I have found something that I pretty much want to copy, the issue is with the coding for the changes.
Here is the link to the video I am using as my base starting point.

Arduino cat feeder

The structure will be made out of PVC pipe with acrylic sheets used for the sliding disks, a screw on top, and possible usb mains supply with a battery option. Generally a little more hardwearing, if successful may become the main feeder.

The main change is that I want it to go off automatically every 12 hours, this is the part I need help programming. With a lot of research I have found a board called an RTC that will help with that and I plan on picking one up tomorrow. My issue is with coding the servo motor to listen to the RTC, and the RTC in general. I can get the servo to go off about every 2.4 hours at the moment, but it needs to be a lot more.

I have read a lot about how RTC’s work and it sounds perfect, but looking into the code for them, it’s just, well, code at the moment.

Any help, advice, or support appreciated. Will try and respond to project questions asap.

Kind regards,
Cup


#2

To paraphrase, you want to run a servo to run every 12 hours, and you’ve managed to get it to run every 2.4 hours. That’s great.

Yes, an RTC can help, because it is a source of reasonably accurate time that will remain accurate enough over your absence. Without an RTC the servo run time will drift with ambient temperature up to about an hour over two weeks. That might be enough for the time being, given the time you have available.

Please post your 2.4 hour sketch without the RTC, in between two lines with three backticks (`) alone on the line, so it appears

likethis

then we can have a look and make suggestions. Or use a pastebin or github gist, or whatever you have access to.


#3

Hi Quozl,

Thanks for your reply.
Yep, that sums it up perfectly. Currently at work, I will put up my script this evening.

Thanks,
Cup


#4

So here is my code as is. It’s a little frankenstein’d…

/*
 * This is a code structure for my Cat feeder. 
 * It needs to get a servo motor to move every 12 hours, 
 * with a long term reasonable degree of accuracy. 
 * Compiled from online resources and learning. For Cat feeder
 * P Hoskins, Canberra, ACT, 04.10.16
*/

#include <Servo.h> //Adds servo library to system

Servo myservo; // names the servo, could also be a number??

const int servoPin = 11; //identifies servo pin
//use of unsigned long here?? or RTC controller

void setup() 
/*set up to show the standard pre loop settings
 * I leant how to attach and detach the servo, stops the horrible buzzing
 * How do I add in the RTC chip??
 */

{
  myservo.attach(servoPin);
  myservo.write(180);
  delay(1000);
  myservo.detach();
}

void loop() 

{
    myservo.attach(servoPin);
    myservo.write(0);
    delay(475); //open and close speed of the servo
    myservo.write(180); //angle is changeable depending on the amount of food delivered
    delay(475); //open and close speed of the servo
    myservo.detach();
    delay(432000); //required to be 12 hour gap here. Currently approx. 2.4 hours
  }
/*This is my basic code so far, please have a look at it and let me know what 
 *needs to change to make the servo motor operate every 12 hours using an RTC to guide the time. 
 *I would like to learn this, however time is of the essence at the moment.
 *further from this as a learning project after the wedding (21.10.16) I would like to add wifi conectability to deliver food, 
 *and also an LCD screed for time/countdown to next feed.
*/

That should do it.
Thanks in advance for having a look at this and letting me know what I can do better, and differently to attach the RTC to time the servo. I am pretty clueless, but I have big ideas if I can get through the basics.

Thanks,

Cup


#5

Thanks, very good start. I saw a problem straight away; where you have a delay(432000);

The delay function uses milliseconds. There are a thousand milliseconds in a second. 432,000 milliseconds is 432 seconds, which is 7.2 minutes. The code as is should operate the servo every 7.2 minutes. If you are seeing 2.4 hours, then that’s inconsistent with the 432,000 delay.

I’m worried something else is wrong. Looking closer at the other delay, you’ve only allowed 475 milliseconds for the servo to move. That’s just under half a second. I would increase that delay. Unless you’ve tested that part already?

Also, if the wires are too long and picked up stray radiofrequency or electrostatic discharge, it could be that what you saw in 2.4 hours was actually a reboot.

You could really do with some way to know it is ticking along. I suggest replacing the long delay with a for loop containing a LED blink, like this;

unsigned int x;
pinMode(13, OUTPUT);
for (x=0;x<43200;x++) {
    digitalWrite(13, 1);
    delay(100);
    digitalWrite(13, 0);
    delay(900);
}

What this does is delay for twelve hours, during which the LED on the Uno will blink for a tenth of a second every second. The LED should be already on pin 13 on the circuit board. You’ll be able to tell it is still working. (With a bit more coding you could also make the LED show how far along the time has got.)

Also you might turn the LED on for the one second delay at boot, just so you can differentiate between a reboot and normal timing operation.

Let me know what RTC you plan to get, so I can give you the right advice. There are many different RTC chips and boards out there.

Here’s my untested attempt to merge my suggestions into your code.

/*
 * This is a code structure for my Cat feeder. 
 * It needs to get a servo motor to move every 12 hours, 
 * with a long term reasonable degree of accuracy. 
 * Compiled from online resources and learning. For Cat feeder
 * P Hoskins, Canberra, ACT, 04.10.16
*/

#include <Servo.h> //Adds servo library to system

Servo myservo; // names the servo, could also be a number??

const int servoPin = 11; //identifies servo pin
//use of unsigned long here?? or RTC controller

void setup() 
/*set up to show the standard pre loop settings
 * I leant how to attach and detach the servo, stops the horrible buzzing
 * How do I add in the RTC chip??
 */

{
    pinMode(13, OUTPUT);
    digitalWrite(13, 1);
    myservo.attach(servoPin);
    myservo.write(180);
    delay(1000);
    myservo.detach();
    digitalWrite(13, 0);
}

void loop() 
{
    unsigned int x;

    myservo.attach(servoPin);
    myservo.write(0);
    delay(475); //open and close speed of the servo
    myservo.write(180); //angle is changeable depending on the amount of food delivered
    delay(475); //open and close speed of the servo
    myservo.detach();

    for (x=0;x<43200;x++) { // blink LED for about 12 hours
        digitalWrite(13, 1);
        delay(100);
        digitalWrite(13, 0);
        delay(900);
    }
}

#6

For the RTC. I’m just a customer of Little Bird Electronics or Jaycar. Both will have what you need. As you will likely go to Jaycar for the RTC, because time is short, I’ve had a quick look.

There’s the XC4450 catalog number, which seems to be a DS1307 chip, based on the downloads link. There’s also the XC5484, also a DS1307. That chip is well known and the datasheet is available from various places.

For the XC4450 you’ll need to solder on header pins or sockets to be able to use it easily with an Uno.

For the XC5484 you’ll need to get either the custom connector it uses, or if the pins are compatible with conventional jumper leads, you can use them.

There’s an Arduino library available for download from Jaycar, and plenty of them out on the internet. You can either use a library, or grab the code lines you need. The DS1307 libraries use the Wire library, which communicates over two wires using a scheme called eye-squared-c (I²C, or I2C).

The DS1307 will need to be told once what time it is, then it will keep time while the battery is there and okay. It will drift a bit, but not very much. I’d have a sketch in my Arduino IDE just to tell it the time, separate to the application sketch. Up to you.

Then the application sketch can read the time every 30 seconds or so, and if it equals what you want, run the servo.

The advantages of using an RTC are;

  • the food delivery will be more accurately timed, happy cat,
  • if the power goes out, the Arduino could recover.

The disadvantages are;

  • you have to install and use extra libraries,
  • you have to set the time,
  • you get to imagine and code for all the ways it can go wrong; e.g. what if the power to the Arduino was out during the critical hours and minutes of a delivery. :grinning:

Hope this helps. Let me know if you’d like to go off-forum; mail to quozl@laptop.org


#7

Hi,
Thank you for looking at that for me. Yep, the delay time for 2.4 hours was different to that, maybe two or three more 0’s on the end. I forgot I was playing with that value trying to max it out. I had thought about using LED (13) blink to keep the program moving along, say every two hours and having that part repeat six times. However on another forum (I read on a similar project) several people put down the idea listing its faults. That is where I read about the RTC board.
I will pick one up from Jaycar tomorrow as they are local, they have the xc4450 in stock, I have some header pins, my soldering could use some practice…should be fine.
I will have some time during the day tomorrow to fiddle around with things more.

I will let you know how I get on.

Thank you,

Cup


#8

Installing extra libraries doesn’t seem too challenging according to the arduino documentation. I will try that tomorrow and go from there.
Cheers,
Cup


#9

I have tested out the code that you have adapted for me. Thank you again, I want to learn how this works, just time is of the essence at the moment.
I have made some changes to test that it works over a short time period, hopefully my conversion and understanding of your program is sound enough for this to work. I have saved this as a seperate sketch. I hope the servo will operate every 15 minutes and the LED will flash every minute.

/*
 * This is a code structure for my Cat feeder. 
 * It needs to get a servo motor to move every 12 hours, 
 * with a long term reasonable degree of accuracy. 
 * Compiled from online resources and learning. For Cat feeder
 * P Hoskins, Canberra, ACT, 04.10.16
*/

#include <Servo.h> //Adds servo library to system

Servo myservo; // names the servo, could also be a number??

const int servoPin = 11; //identifies servo pin
//use of unsigned long here?? or RTC controller

void setup() 
/*set up to show the standard pre loop settings
 * I leant how to attach and detach the servo, stops the horrible buzzing
 * How do I add in the RTC chip??
 */

{
    pinMode(13, OUTPUT);
    digitalWrite(13, 1);
    myservo.attach(servoPin);
    myservo.write(180);
    delay(1000);
    myservo.detach();
    digitalWrite(13, 0);
}

void loop() 
{
    unsigned int x;

    myservo.attach(servoPin);
    myservo.write(0);
    delay(300); //open speed of the servo
    myservo.write(180); //angle is changeable depending on the amount of food delivered
    delay(300); //close speed of the servo
    myservo.detach();

    for (x=0;x<9;x++) { // blink LED for about 15 minutes?? TEST ONLY
        digitalWrite(13, 1);
        delay(100);
        digitalWrite(13, 0);
        delay(60000); //one minute delay
    }
}

I will know in about fifteen minutes…

I have bought the RTC module from Jaycar, only to find that I can’t yet load libraries into arduino 1.6.12, it looks like the teenyduino loader is in beta testing for 1.6.12 so I will have to wait a little as I am not experienced enough to add value to that test.
(confirmed LED flash every 60 seconds)

The RTC will have to wait for a more permanent long term cat feeder, it seems the LED clock will work with enough short term accuracy for my cats to be fed while I get married.
Thank you, I am sure I will be back before long.

I have done a bit more playing around with the servo speed, it seems the lower this delay is,

delay(300);

the faster the servo moves, small number equals less food, vice versa, I will play around with it but for now I have lowered it further (for testing only), I will only settle on that value in final testing as it will be affected by the size of the food hole I cut etc.

EDIT
It seems I miss understood your code, it changed the LED blink loop to minutes (??), I assumed seconds, so when I changed it to 9, thinking that 9; x++ meant it would loop for 900 seconds. 15 (minutes) x 60 (seconds) = 900, I assumed that this was the correct way to test it out. That makes it move the servo every nine minutes. It seems I neither understood your code, nor could I do the conversions. I have learnt more though. I will sat up a 12 hour test tonight.
EDIT

Thank you again,
Regards,
Cup


#10

Sorry for the delay, was out for the Warrumbungle Landcare Group annual general meeting and breakfast. :grinning:

Using the LED will draw more power, and that’s the biggest reason for not using it in the final version, but I wanted you to use it temporarily to make sure the microcontroller is staying alive, hence flashing once a second. It’s hard to sit there for a minute. If you’re using wall power, the difference is not great; the Uno itself has a USB chip that consumes almost as much as an LED, last time I tested it. The video you pointed to originally pointed out the Arduino Pro Mini is the equivalent low power module, and I’ve used tens of them.

The other way to read my for loop code is this;

  • the duration of a digitalWrite call is insignificant compared to the delays,
  • each time through the loop consumes one second (100 ms with LED on, 900 ms with LED off),
  • the total time given by the number after the > sign, is measured in seconds.

So your code above, which changed from one second per loop to one minute per loop, should really have a delay(59900) rather than delay(60000), so that the delays add up. And a twelve hour test will be for 720 minutes.


#11

That sounds like a really nice morning!! No problem at all, I am just glad to be getting some help with this. I am confident enough now on this side that I am happy to start building a prototype.

Okay, that makes sense, and clears up why I was unable to get the loop to reset every fifteen minutes. The loop is “timed” on the light, and the
(x=0;x<43200;x++)
tells it how many times to cycle the LED. That makes sense. Using the small numbers to multiply up to a longer delay between the servo loop. NICE!!
Which is why my

for (x=0;x<9;x++) { // blink LED for about 15 minutes?? TEST ONLY
        digitalWrite(13, 1);
        delay(100);
        digitalWrite(13, 0);
        delay(60000); //one minute delay

made the servo activate every nine minutes. It would also go out of step and run long between the servo cycles, not enough to notice over a day, but a month or so and it would drift out, getting later every day.
I would like this system to run reliably on batteries in the long term (multi day holidays), however having a mains source short term (one day) is not a problem.
So an accurateforloop giving a light every minute, with fifteen minutes between servo cycles should look like this;

 for (x=0;x<15;x++) { // blink LED for 15 minutes?? TEST ONLY
        digitalWrite(13, 1);
        delay(100);
        digitalWrite(13, 0);
        delay(59000);

With <720; for a twelve hour cycle?

I have purchased the Duinotech tiny RTC which is a DS1307. As above, I am having issues getting the library to load into arduino 1.6.12. I will wait for the loader to go past Beta before trying it out. What we have at the moment is working well enough to cover the build for the wedding day.

Regards,

Cup


#12

Agreed, you’re nearly done and can get back to the flowers. :grinning:

So an accurate for loop giving a light every minute, with fifteen minutes between servo cycles should look like this;

for (x=0;x<15;x++) { // blink LED for 15 minutes?? TEST ONLY
       digitalWrite(13, 1);
       delay(100);
       digitalWrite(13, 0);
       delay(59000);

Add 59000 to 100 and you get 59100, so no, it won’t be as accurate as it would if you add up to 60000 instead. But if you change 100 to 1000 it will, and the LED will be on long enough for anyone to notice without trying too hard.

With <720; for a twelve hour cycle?

Yes.

Once you fix the addition, upload to the Uno, and get out your stopwatch app and time the interval between one flash and the next, and increase the accuracy of measurement by timing several flashes. Divide the stopwatch time by the number of flashes excluding the first (i.e. minus one) and you’ll have a good idea how much drift to expect. There will be some drift; the Uno oscillator is not perfect, and the Duinotech Uno is cheap for good reasons, and one of those reasons may be their choice of timing crystal.

I’ve done a similar project several times now, though not for cat feeding, but for something else, 24 hours or 48 hours, with a button to press, and I’ve chosen a delay of a few minutes under, so that even with varying drift it will almost never be late, and I use the button to correct the drift every few days or weeks. Yours already has such a button; reset!

On the RTC:

If the DS1307 has already been programmed in factory, then it has a SQ output pin that sends a pulse every second. Prove it by attaching an LED through 1K resistor, see if it flashes. You could tie that pin to the Uno as an input, and get the Uno to just count those accurate seconds as if it was a push button input. You will of course also tie the Uno GND to the RTC module, and the appropriate UNO supply voltage pin to the RTC module power input pin.

On the troubles you have with loading the supplied library:

If you can get the Wire library that is included with the Arduino IDE to load, using the example sketches, then you could program the RTC without using the DS1307 library. The DS1307 library is mostly just a nice detail-hiding wrapper. Dig into the source code for the DS1307 and you’ll see what I mean.

Actually, I’ve an old example here which makes it look easy; probably from an older version of the Arduino IDE;

#include "Wire.h"
#define DS1307_ADDRESS 0x68

void setup(){
  Wire.begin();
  Serial.begin(9600);
}

void loop(){
  printDate();
  delay(1000);
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

void printDate(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);

  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());

  //print the date EG   3/1/11 23:59:59
  Serial.print(month);
  Serial.print("/");
  Serial.print(monthDay);
  Serial.print("/");
  Serial.print(year);
  Serial.print(" ");
  Serial.print(hour);
  Serial.print(":");
  Serial.print(minute);
  Serial.print(":");
  Serial.println(second);
}

This reads the time and date every second and prints it on the serial port, so that it can be shown on your computer over the USB cable.


#13

I can see my attention to detail needs to improve. I have noticed this with capital letters in sketches as well. That is what I meant to put in. Just getting a little excited that I understand how this is all fitting together, albeit slowly.
I will carry on playing around with the RTC as I have time.
It does have an SQ output, I couldn’t make an LED flash with it though. However using your code I managed to read this in the serial reader -
165/165/165 45:165:165
165/165/165 45:165:165
It does repeat every second, guess I need to look at setting up LED’s again…also as it’s repeating the same 165… each time, will I need to set the time on it? So I could, as you say, use this as a digital input to stamp one second intervals and clock them up to the relevant number. Is that not getting to be too big for the board to count? The same issue with giving it a delay. Or would you program the same type of system.
Flash LED every 3600 pulses, run servo every 12 LED flashes? For a 12 hour timer.

Regards,

Cup


#14

Sorry, I’m getting a bit lost.

The board can count up to a number over two billion using a 32-bit unsigned integer (long int), so that’s not a worry. But several ways to make mistake in coding, and hard to test long timers easily, so best is to code something you can prove responds correctly to a single number, then change that number.

The 165/165/165 looks wrong. I think the clock in the DS1307 isn’t yet set. The arrival every second is because of the delay(1000); in the example, so that isn’t any more useful than what you have working already.

I’ve just read the DS1307 datasheet to check a few things.

  • it is a 5V device, so check you have attached the Uno supply voltage pin 5V to the RTC module,

  • the SQ output is a FET that switches to GND, so attach negative of LED to SQ, then positive of LED to resistor, and other end of resistor to 5V, this is because page 6 says;

    When enabled, the SQWE bit set to 1, the SQW/OUTpin outputs one of four square-wave frequencies (1Hz, 4kHz, 8kHz, 32kHz). The SQW/OUT pin is open drain and requires an external pullup resistor. SQW/OUT operates with either VCC or VBAT applied. The pullup voltage can be up to 5.5V regardless of the voltage on VCC. If not used, this pin can be left floating.

  • the actual signal on SQ will depend on configuration registers set by factory, but you can write a sketch to configure them. Page 9 describes the control register which contains SQWE and rate select bits. As part of writing a sketch to set the time, you’d also have to write values to this control register to get the SQ output going.

p.s. get another Uno so you can continue to experiment while you have the first one engaged. Because these Uno boards can stop working if you make a wiring mistake or hit them with electrostatic discharge. A damaging discharge can happen without you noticing it, and the effect can be either instant or take several weeks. Or, you can get the plug-in chip, depending on your budget. But a second one makes experimenting more relaxing. I’ve lost count of how many I have!


#15

I’ve just grabbed a Uno and a DS1307 but not yet connected them, and 165/165/165 is what you get when there is nothing attached.


#16

Y nothing attached do you mean I have connected them wrong physically, or the time has not been written by the factory?
Now I’m confused.
Have ordered a second board to keep playing with. Sound advice :wink:

Regards,
Cup


#17

Can’t tell what you’ve done from here, but you might check your wiring;

  • SDA to A4,
  • SCL to A5,
  • 5V
  • GND

I’ve got my DS1307 delivering a 1 Hz square wave now!


#18

I’ve been enjoying myself at your expense, hope you don’t mind.

What I did was attach a DS1307 to an Arduino Uno and wrote a sketch that will restart the RTC, enable the SQ output for one pulse per second, and then synchronise an action against the SQ. The action is just reading and dumping the registers. Serial monitor looks like this;

00 00 00 00 00 00 00 90 
01 00 00 00 00 00 00 90 
02 00 00 00 00 00 00 90 
03 00 00 00 00 00 00 90 
04 00 00 00 00 00 00 90 
05 00 00 00 00 00 00 90 
06 00 00 00 00 00 00 90 
07 00 00 00 00 00 00 90 

One line every second. Nice and precise. The numbers are hexadecimal, with a space between each register. The registers in the datasheet begin with seconds, which is why you see the number advancing.

Then I changed the sketch to light up the Uno D13 LED as soon as possible after the rising edge of SQ is detected. So I get the LED blinking for a tenth of a second every second.

Then I was curious as to how quickly the Uno was able to respond to the SQ pin, so I hooked up a digital storage oscilloscope to capture a screenshot of voltage over time for the SQ and the D13 pins; the horizontal scale is 5 microseconds per grid square.

This told me that when the SQ pin (yellow) rises the Uno is able to detect that and react within about 14 microseconds. That’s way good enough.

Here’s my sketch;

// test program for an RTC synchronised per-second timing pulse, quozl@laptop.org
// Arduino Uno vs DS1307 RTC,
// Wiring; A4 -> SDA, A5 -> SCL, D2 -> SQ,
// Probing; DSO channel 1 (yellow) to SQ, channel 2 (blue) to D12 (LED)
#include "Wire.h"
#define DS1307_ADDRESS 0x68

void hex(byte x) { // on serial print a byte in hex with trailing space
  char buf[4];
  
  sprintf(buf, "%02.2x ", x);
  Serial.print(buf);
}

void restart() { // restart the clock from zero, configure SQ for 1Hz
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(0); // register address to begin writing to
  Wire.write(0); // CH, seconds ( clearing CH starts counting )
  Wire.write(0); // minutes
  Wire.write(0); // hours
  Wire.write(0); // day of week
  Wire.write(0); // day of month
  Wire.write(0); // month
  Wire.write(0); // year
  Wire.write(0x90); // OUT, 0, 0, SQWE, 0, 0, RS1, RS0 ( 1Hz )
  Wire.endTransmission();
}

void dump() { // on serial dump all registers in hex
  byte i, response[8];

  // ask for DS1307 to send register data
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(0);
  Wire.endTransmission();

  // receive the data into a response buffer
  Wire.requestFrom(DS1307_ADDRESS, 8);
  for(i=0;i<8;i++) response[i] = Wire.read();
  
  // print the data
  for(i=0;i<8;i++) hex(response[i]);
  Serial.println();
}

void wait() { // wait for next transition of SQ
  while (digitalRead(2) == 0) continue; // wait for rising edge
  digitalWrite(13, 1);
  delay(100);
  digitalWrite(13, 0);
  while (digitalRead(2) == 1) continue; // wait for falling edge
  delay(100);
}

void setup() {
  pinMode(13, OUTPUT); // LED on Uno, and channel 2 of oscilloscope (light blue)
  Wire.begin();
  Serial.begin(9600);
  restart();
}

void loop() { // dump registers every second by listening to SQ
  dump();
  wait();
}

Understanding how this works will really help your next step with the RTC.


#19

Awesome, please feel free to enjoy yourself, I am learning heaps!!!
I won’t have time to look over that tonight, but will check it out over the weekend.

Regards,
Cup


#20

The 12 hour test was a partial success, the program ran flawlessly, however I think running it off batteries overnight caused a few issues. When the servo activated in the morning at 8am, the LED flashed but the servo didn’t actuate. Then the board seemed to go into a refresh cycle until powered off. It’s a reasonable size servo so the 4 rechargeable AAs might not have enough juice to push it. The unit will run from mains on the day so that won’t be an issue.
However…
I could try bypassing the 5v on the board and taking 6v to the servo directly. Or adding in a 5v relay to have a larger current for the servo. Is this massively complicated??
I find my self getting caught up in the future.

Also Noob question about the above script, the DS1307 is an analogue input (right?) as it reads more than just 1 or 0, right? I am pretty sure I connected mine up to the digital pins when testing it yesterday.

Means SDA analogue pin 4 + SCL to analogue pin 5, I had the board connected wrong. I had it going into the digital side of the board, I was still getting a serial read though through D7, that was my 165… reading. I will try again with the A pins.

Thanks,

Cup