Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. airmedic79
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    airmedic79

    @airmedic79

    0
    Reputation
    5
    Posts
    3
    Profile views
    2
    Followers
    0
    Following
    Joined Last Online

    airmedic79 Follow

    Best posts made by airmedic79

    This user hasn't posted anything yet.

    Latest posts made by airmedic79

    • Help me build a RFM69 gateway using wemos d1 + keyestudio RFM69 shield

      Hi!
      I am trying to build a RFM69 gateway with wemos d1 and keyestudio RFM69 shield. The code is compiled and uploaded but I see no serial log nor wifi connection. It just doesn't show anything. Can I set up the gateway? Thanks in advance.

      • arduino ide 2.3.2
      • mysensors 2.3.2
      • esp8266 board 2.7.4 (ver 3.1.2 won't upload the code)

      The RFM69 shield is from Keyestudio.
      https://wiki.keyestudio.com/KS0515_Keyestudio_FSK_Wireless_Shield_RFM69HCW_868mhz(Black_and_Eco-friendly)

      Here's the code.

      // Enable debug prints to serial monitor
      #define MY_DEBUG

      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 9600

      // Enables and select radio type (if attached)
      #define MY_RADIO_RFM69
      #define MY_RFM69_FREQUENCY RFM69_868MHZ // Set your frequency here
      #define MY_IS_RFM69HW

      #define MY_GATEWAY_ESP8266

      #define MY_WIFI_SSID "**"
      #define MY_WIFI_PASSWORD "
      "

      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
      #define MY_HOSTNAME "WEMOSD1_GW"

      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,0,146

      // If using static ip you can define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0

      // The port to keep open on node server mode
      #define MY_PORT 5003

      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 20

      #include <MySensors.h>

      void setup()
      {
      // Setup locally attached sensors
      }

      void presentation()
      {
      // Present locally attached sensors here
      }

      void loop()
      {
      // Send locally attached sensors data here
      }

      posted in Troubleshooting
      airmedic79
      airmedic79
    • Help me build a 6-light-sensor & 2 ch relay node.

      Hi!
      I am trying to build a 6-light-sensor & 2 ch relay node to control my old dehumidifier. When I disassembled it, I found 2 switches (power & mode) and 6 leds which can be used to control and report status. Also it has 5v output.

      novita.jpg

      Below is the sketch I came up with. It is showing the light sensor values as below but can't see 2ch relay switches. Am I missing something?

      log.jpg


      // Enable debug prints
      #define MY_DEBUG
      // Enable and select radio type attached
      #define MY_RADIO_RF24
      //#define MY_RADIO_RFM69
      //#define MY_RS485
      #define MY_NODE_ID 7
      #define RELAY_PIN 3 // Arduino Digital I/O pin number for power relay (connected to D3)
      #define RELAY_PIN 4 // Arduino Digital I/O pin number for mode relay (connected to D4)
      #define NUMBER_OF_RELAYS 2 // Total number of attached relays (2 in this case)
      #define RELAY_ON 1 // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay

      #define CHILD_ID_LIGHT_1 0
      #define CHILD_ID_LIGHT_2 1
      #define CHILD_ID_LIGHT_3 2
      #define CHILD_ID_LIGHT_4 3
      #define CHILD_ID_LIGHT_5 4
      #define CHILD_ID_LIGHT_6 5

      #include <SPI.h>
      #include <MySensors.h>

      #define LIGHT_SENSOR_1_ANALOG_PIN A0
      #define LIGHT_SENSOR_2_ANALOG_PIN A1
      #define LIGHT_SENSOR_3_ANALOG_PIN A2
      #define LIGHT_SENSOR_4_ANALOG_PIN A3
      #define LIGHT_SENSOR_5_ANALOG_PIN A4
      #define LIGHT_SENSOR_6_ANALOG_PIN A5

      MyMessage msgLight1(CHILD_ID_LIGHT_1, V_LIGHT_LEVEL);
      MyMessage msgLight2(CHILD_ID_LIGHT_2, V_LIGHT_LEVEL);
      MyMessage msgLight3(CHILD_ID_LIGHT_3, V_LIGHT_LEVEL);
      MyMessage msgLight4(CHILD_ID_LIGHT_4, V_LIGHT_LEVEL);
      MyMessage msgLight5(CHILD_ID_LIGHT_5, V_LIGHT_LEVEL);
      MyMessage msgLight6(CHILD_ID_LIGHT_6, V_LIGHT_LEVEL);

      void before()
      {
      for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
      // Then set relay pins in output mode
      pinMode(pin, OUTPUT);
      // Set relay to last known state (using eeprom storage)
      digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
      }

      void presentation() {
      // Send the presentation to the controller
      sendSketchInfo("Dehumidifier Controller", "1.0");
      present(CHILD_ID_LIGHT_1, S_LIGHT_LEVEL);
      present(CHILD_ID_LIGHT_2, S_LIGHT_LEVEL);
      present(CHILD_ID_LIGHT_3, S_LIGHT_LEVEL);
      present(CHILD_ID_LIGHT_4, S_LIGHT_LEVEL);
      present(CHILD_ID_LIGHT_5, S_LIGHT_LEVEL);
      present(CHILD_ID_LIGHT_6, S_LIGHT_LEVEL);
      for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
      // Register all sensors to gw (they will be created as child devices)
      present(sensor, S_BINARY);
      }
      }

      void setup() {
      // Setup code here if needed
      }

      void loop() {
      // Check light levels
      int lightLevel1 = analogRead(LIGHT_SENSOR_1_ANALOG_PIN);
      int lightLevel2 = analogRead(LIGHT_SENSOR_2_ANALOG_PIN);
      int lightLevel3 = analogRead(LIGHT_SENSOR_3_ANALOG_PIN);
      int lightLevel4 = analogRead(LIGHT_SENSOR_4_ANALOG_PIN);
      int lightLevel5 = analogRead(LIGHT_SENSOR_5_ANALOG_PIN);
      int lightLevel6 = analogRead(LIGHT_SENSOR_6_ANALOG_PIN);

      // Invert the light sensor values: Map the range 0 to 1023 to 100 to 0
      lightLevel1 = map(lightLevel1, 0, 1023, 100, 0);
      lightLevel2 = map(lightLevel2, 0, 1023, 100, 0);
      lightLevel3 = map(lightLevel3, 0, 1023, 100, 0);
      lightLevel4 = map(lightLevel4, 0, 1023, 100, 0);
      lightLevel5 = map(lightLevel5, 0, 1023, 100, 0);
      lightLevel6 = map(lightLevel6, 0, 1023, 100, 0);

      Serial.print("Light1: ");
      Serial.println(lightLevel1);
      Serial.print("Light2: ");
      Serial.println(lightLevel2);
      Serial.print("Light3: ");
      Serial.println(lightLevel3);
      Serial.print("Light4: ");
      Serial.println(lightLevel4);
      Serial.print("Light5: ");
      Serial.println(lightLevel5);
      Serial.print("Light6: ");
      Serial.println(lightLevel6);

      send(msgLight1.set(lightLevel1));
      send(msgLight2.set(lightLevel2));
      send(msgLight3.set(lightLevel3));
      send(msgLight4.set(lightLevel4));
      send(msgLight5.set(lightLevel5));
      send(msgLight6.set(lightLevel6));

      // Add any other code for the loop here
      delay(1000); // Adjust the delay as needed to control the update rate of the light sensor values
      }

      void receive(const MyMessage &message)
      {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.getType()==V_STATUS) {
      // Change relay state
      digitalWrite(message.getSensor()-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
      // Store state in eeprom
      saveState(message.getSensor(), message.getBool());
      // Write some debug info
      Serial.print("Incoming change for sensor:");
      Serial.print(message.getSensor());
      Serial.print(", New status: ");
      Serial.println(message.getBool());
      }
      }

      posted in Troubleshooting
      airmedic79
      airmedic79
    • RE: Requesting for help building traffic light led module node

      I am sharing my sketch. Based on the sketch below, I am using this led light to show air quality status (good for green, normal for yellow and bad for red). This sketch is just a switch so you should make some automation in HA.

      https://www.amazon.com/Traffic-Display-Module-Arduino-Mini-Traffic/dp/B07SZMRSDN


      #define MY_DEBUG
      #define MY_RADIO_RF24
      #define MY_NODE_ID 16
      #define MY_RF24_PA_LEVEL RF24_PA_LOW

      #include <MySensors.h>

      #define CHILD_ID_GREEN 1
      #define CHILD_ID_YELLOW 2
      #define CHILD_ID_RED 3

      #define GREEN_PIN 3
      #define YELLOW_PIN 4
      #define RED_PIN 5

      bool greenState = false;
      bool yellowState = false;
      bool redState = false;

      MyMessage msgGreen(CHILD_ID_GREEN, V_LIGHT);
      MyMessage msgYellow(CHILD_ID_YELLOW, V_LIGHT);
      MyMessage msgRed(CHILD_ID_RED, V_LIGHT);

      void setup() {
      Serial.begin(115200);
      pinMode(GREEN_PIN, OUTPUT);
      pinMode(YELLOW_PIN, OUTPUT);
      pinMode(RED_PIN, OUTPUT);
      wait(200);
      }

      void presentation() {
      // Initialize the MySensors communication
      sendSketchInfo("Traffic Light Node", "1.0");
      present(CHILD_ID_GREEN, S_LIGHT);
      present(CHILD_ID_YELLOW, S_LIGHT);
      present(CHILD_ID_RED, S_LIGHT);
      }

      void loop() {
      // Send initial values of the LEDs to the controller
      send(msgGreen.set(greenState ? 1 : 0));
      send(msgYellow.set(yellowState ? 1 : 0));
      send(msgRed.set(redState ? 1 : 0));

      // Other tasks in the loop if needed
      // ...

      // Add a delay to control how often the initial values are sent
      delay(5000); // Send initial values every 5 seconds (adjust as needed)
      }

      void receive(const MyMessage &message) {
      // Check which LED to control based on the message received
      if (message.sensor == CHILD_ID_GREEN && message.type == V_LIGHT) {
      greenState = !greenState; // Toggle the state
      digitalWrite(GREEN_PIN, greenState ? HIGH : LOW); // Set the pin accordingly
      send(msgGreen.set(greenState ? 1 : 0)); // Report back the new state
      } else if (message.sensor == CHILD_ID_YELLOW && message.type == V_LIGHT) {
      yellowState = !yellowState;
      digitalWrite(YELLOW_PIN, yellowState ? HIGH : LOW);
      send(msgYellow.set(yellowState ? 1 : 0));
      } else if (message.sensor == CHILD_ID_RED && message.type == V_LIGHT) {
      redState = !redState;
      digitalWrite(RED_PIN, redState ? HIGH : LOW);
      send(msgRed.set(redState ? 1 : 0));
      }
      }

      posted in Troubleshooting
      airmedic79
      airmedic79
    • RE: Requesting for help building traffic light led module node

      @electrik Wow! You gave me a clue! Thanks!!

      posted in Troubleshooting
      airmedic79
      airmedic79
    • Requesting for help building traffic light led module node

      Hi!
      I'm trying to build a traffic light led module node on a arduino pro mini 5v. I am currently using a temperature/humidity node without a problem with raspberry pi ethernet gateway.

      Below is the sketch I'm working on. Its function is only to toggle in home assistant. When uploaded, it seems to be communicating with the gateway but doesn't show up in home assistant.

      I'd like to know if there's something wrong with the sketch.
      Thanks in advance!

      --sketch--
      #define MY_DEBUG
      #define MY_RADIO_RF24
      #define MY_NODE_ID 16
      #define MY_RF24_PA_LEVEL RF24_PA_LOW

      #include <MySensors.h>

      #define CHILD_ID_GREEN 1
      #define CHILD_ID_YELLOW 2
      #define CHILD_ID_RED 3

      #define GREEN_PIN 3
      #define YELLOW_PIN 4
      #define RED_PIN 5

      bool greenState = false;
      bool yellowState = false;
      bool redState = false;

      MyMessage msgGreen(CHILD_ID_GREEN, V_LIGHT);
      MyMessage msgYellow(CHILD_ID_YELLOW, V_LIGHT);
      MyMessage msgRed(CHILD_ID_RED, V_LIGHT);

      void setup() {
      Serial.begin(115200);
      pinMode(GREEN_PIN, OUTPUT);
      pinMode(YELLOW_PIN, OUTPUT);
      pinMode(RED_PIN, OUTPUT);
      wait(200);
      }

      void presentation() {
      // Initialize the MySensors communication
      sendSketchInfo("Traffic Light Node", "1.0");
      present(CHILD_ID_GREEN, S_LIGHT);
      present(CHILD_ID_YELLOW, S_LIGHT);
      present(CHILD_ID_RED, S_LIGHT);
      }

      void loop() {

      }

      void receive(const MyMessage &message) {
      // Check which LED to control based on the message received
      if (message.sensor == CHILD_ID_GREEN && message.type == V_LIGHT) {
      greenState = !greenState; // Toggle the state
      digitalWrite(GREEN_PIN, greenState ? HIGH : LOW); // Set the pin accordingly
      send(msgGreen.set(greenState ? 1 : 0)); // Report back the new state
      } else if (message.sensor == CHILD_ID_YELLOW && message.type == V_LIGHT) {
      yellowState = !yellowState;
      digitalWrite(YELLOW_PIN, yellowState ? HIGH : LOW);
      send(msgYellow.set(yellowState ? 1 : 0));
      } else if (message.sensor == CHILD_ID_RED && message.type == V_LIGHT) {
      redState = !redState;
      digitalWrite(RED_PIN, redState ? HIGH : LOW);
      send(msgRed.set(redState ? 1 : 0));
      }
      }

      --serial communication--
      2158 TSF:MSG:FPAR OK,ID=0,D=1
      4065 TSM:FPAR:OK
      4066 TSM:ID
      4067 TSM:ID:OK
      4069 TSM:UPL
      4072 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      4078 TSF:MSG:READ,0-0-16,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      4083 TSF:MSG:PONG RECV,HP=1
      4086 TSM:UPL:OK
      4087 TSM:READY:ID=16,PAR=0,DIS=1
      4092 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      4100 TSF:MSG:READ,0-0-16,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      4107 TSF:MSG:SEND,16-16-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
      4117 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      4132 TSF:MSG:READ,0-0-16,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      4143 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=OK:Traffic Light Node
      4152 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      4160 TSF:MSG:SEND,16-16-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
      4170 TSF:MSG:SEND,16-16-0-0,s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
      4178 TSF:MSG:SEND,16-16-0-0,s=3,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
      4185 MCO:REG:REQ
      4188 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      4197 TSF:MSG:READ,0-0-16,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      4202 MCO:PIM:NODE REG=1
      4204 MCO:BGN:STP
      4406 MCO:BGN:INIT OK,TSP=1
      519129 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
      519134 TSF:MSG:BC
      520131 TSF:MSG:SEND,16-16-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0

      posted in Troubleshooting
      airmedic79
      airmedic79