0

I have been assigned to set up these fish autofeeders that have been assembled . The goal is to have the autofeeders installed on top of the fish tank and dispensing food at chosen times (so somehow retrieving information about global timing).

I need to program and install 15 such systems. I also have access to 1 Raspberry pi (which I think will help with keeping clock time? I am not sure).

A NodeMCU board is attached to a custom PCB. It seems through the PCB the servo (which controls and rotates the feeder to allow food to drop) is connected to the board's D4 pin. An LED also seems to be connected to the D5 pin (not sure what this can be used for, maybe showing that the system is active or food is being dispensed something of that sort).

This connection goes through a resistor on the PCB (labeled 1k). There also seems to be a small battery or something connected via the PCB (I think it is connected to VIN and has a label of 70uF, so might be a capacitor instead).

According to online sources I cannot retrieve the program that was uploaded onto the board when they were used before, so I need to code the program from scratch and I have no idea how to start.

I tried to upload the example blink sketch, changing the LED pin to D5 but nothing happened.

Any and all guidance on how to proceed would be really really appreciated. If any more information about the system/pictures are needed I'll be happy to add on too.

/*
  ESP8266 Blink by Simon Peter
  Blink the blue LED on the ESP-01 module
  This example code is in the public domain

  The blue LED on the ESP-01 module is connected to GPIO1
  (which is also the TXD pin; so we cannot use Serial.print() at the same time)

  Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

const int LED_Pin = D5;

void setup() {
  pinMode(LED_Pin, OUTPUT);  // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_Pin, LOW);  // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_Pin, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}
New contributor
user103753 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • 1
    what is your question? ... please add a focused, answerable question to your post
    – jsotola
    Commented Sep 3 at 3:52
  • So the upload succeeded, but the LED doesn't blink, right? And the connection for it goes D5 -> resistor -> LED+, LED- -> ground ? Have you a multimeter to check the voltage on D5? Is it changing? Are you sure, that you are compiling for the NodeMCU in the Arduino IDE? Please also try changing D5 to 14 (as D5 should be GPIO14).
    – chrisl
    Commented Sep 3 at 7:20
  • 1
    If you are sure it is a NodeMCU, then LED_BUILTIN is defined as 2 which is D4. See pin_arduino.h of NodeMCU.
    – hcheung
    Commented Sep 3 at 11:18

1 Answer 1

0

Since you have 15 systems but only one Raspberry Pi, you can use the Raspberry Pi to retrieve the current time via NTP (Network Time Protocol) and then broadcast it to all the NodeMCU boards. You have to set up NTP on Raspberry pi. Then you can write a Python script that sends the current time to the NodeMCU boards over Wi-Fi using UDP or MQTT. You must program the NodeMCU for Scheduled Feeding. The NodeMCU should connect to wifi, Sync time with the Raspberry Pi (using UDP or MQTT) and Rotate the servo at the scheduled feeding times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.