Navigation

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

    Posts made by numanx

    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      @NeverDie @mfalkvidd
      Today I've resoldered the ESP8266 Chip.
      Everything works perfect.
      Thanks for your help!

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      @mfalkvidd
      It seems that ESP8266 doesn't support SOFTSPI

      In file included from /home/numanx/Arduino/ESP8266OTA/ESP8266OTA.ino:120:0:
      /home/andreihering/Arduino/libraries/MySensors/MySensors.h:248:2: error: #error Soft SPI is not available on ESP8266
      
      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      Finally got it!
      It seems that I have a problem with the ESP8266.
      After about 24 Hours of debugging I found the problem...

      Steps:
      Checked if the wiring is good with a multimeter probe on each pin of the adapter(which I know it worked) and each pin of the radio to verify the correct pinout.
      It seems that the pinout was ok and the wiring was also ok.
      Write a sketch with all the ports from D2 to D8 in output HIGH and with a little buzzer I've tested each pin.
      It seems that D7 doesn't give voltage.
      Checked the pinout diagram for the ESP-12E. Checked for continuity between GPIO13(from the chip) and D7 and there was no continuity.
      Tried to connect the radio MOSI Pin directly to GPIO13 and IT WORKED!

      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:INIT:TSP OK
      0;255;3;0;9;TSM:INIT:GW MODE
      0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;MCO:REG:NOT NEEDED
      

      Is there any way to move the MOSI pin from the board to another digital pin from ESP8266?
      Thanks!

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      0_1502912006276_IMG_1592.JPG

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      Here are the photos of the ESP8266 board, NR24L01+ and the wiring.
      1_1502911770672_IMG_1597.JPG 0_1502911770672_IMG_1596.JPG 0_1502911837444_IMG_1594.JPG 0_1502911797701_IMG_1592.JPG 0_1502911843654_IMG_1595.JPG

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      Ok, I've solved the problem with the Wireless SSID and password by uploading the HelloServer sketch from the ESP8266 examples.
      Now I rewire the ESP8266 and Radio and I will post some photos.

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      Now I have another problem...
      I've tried to change the Wireless SSID and Password in the sketch and it seems that after uploading on the ESP8266 it doesn't update them. I've tried clearing EEPROM memory and now the ESP8266 seems to be stucked in the AP mode and I have some strange characters when I open Serial Monitor...

      0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGE--,VER=2.1.1
      0;255;3;0;9;TSF:LRT:OK
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSF:WUR:MS=0
      0;255;3;0;9;!TSM:INIT:TSP FAIL
      0;255;3;0;9;TSM:FAIL:CNT=1
      0;255;3;0;9;TSM:FAIL:PDT
      chg_A2:-40
      
      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      @NeverDie
      The board selected is NodeMCU 1.0 (ESP-12E module)
      I've tried suplying the adapter with 3.3v and also with 5V.

      @mfalkvidd
      Now the radio is connected directly to the ESP8266 but still I have the same error.

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      @sundberg84 @NeverDie
      Thanks for your answers.
      I've connected the ESP8266 and NRF24L01+ exactly as described in Connecting the Radio(https://www.mysensors.org/build/connect_radio) at the NRF24L01+ & ESP8266 section.
      Still the same error, I've tried rewiring a couple of times using different wires.

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      @sundberg84
      The ESP8266 was running from my PC using a usb cable.
      I've tried to power the NRF24L01+ from the ESP8266 directly with dupont cable also I've tried through the Socket adapter plate board. I've tried to power the NRF24L01+ from a 5V power supply. The NRF24L01+ ground was common with the ESP8266 ground and the VCC on the adapter(which pass through the 5V to 3.3V regulator and then to NRF24L01+) was connected from the 5V power supply.

      I am using the NodeMCU as described in the following link https://www.mysensors.org/build/connect_radio#nrf24l01+-&-esp8266

      posted in Hardware
      numanx
      numanx
    • RE: [SOLVED] Problems with ESP8266 and NRF24L01+

      This is the sketch that I'm using.

      // 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_NRF24
      #define MY_GATEWAY_ESP8266
      
      #define MY_ESP8266_SSID "MySSID"
      #define MY_ESP8266_PASSWORD "MyVerySecretPassword"
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,178,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 2
      
      #if defined(MY_USE_UDP)
      #include <WiFiUdp.h>
      #endif
      
      #include <ESP8266WiFi.h>
      
      #include <MySensors.h>
      
      void setup()
      {
      }
      
      void presentation()
      {
      	// Present locally attached sensors here
      }
      
      
      void loop()
      {
      	// Send locally attached sensors data here
      }```
      posted in Hardware
      numanx
      numanx
    • [SOLVED] Problems with ESP8266 and NRF24L01+

      Hello,
      I have a problem using an ESP8266 and a NRF24L01+ module.
      I followed all the steps from this guide https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help and still it won't work.
      I am using an adapter like this https://www.aliexpress.com/item/5pcs-Socket-Adapter-Module-Board-for-NRF24L01-Wireless-Module/32368381876.html for converting the power and for power stability.
      I have two NRF24L01+ modules and I've tested them with an Arduino Nano which it works.
      I can't get it to work with ESP8266, I've checked the wirings multiple times.
      Arduino IDE 1.6.8 with latest version of MySensors Library on Linux and Mac OS X using an ESP8266 and NRF24L01+
      I've tried to power the module directly from ESP8266 and separately from a 5V PSU with the 5V regulator adapter and common ground with the ESP8266.

      Thanks for your help!

      This is the serial monitor error:

      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;!TSM:INIT:TSP FAIL
      0;255;3;0;9;TSM:FAIL:CNT=7
      0;255;3;0;9;TSM:FAIL:PDT
      0;255;3;0;9;TSM:FAIL:RE-INIT```
      posted in Hardware
      numanx
      numanx
    • RE: Multiple Servos

      Found this on arduino.cc forum.
      I think there should be a way for creating different servo objects for each servo but I don't know how to do that.

      Any sugestion from @mfalkvidd ?

      #include <Servo.h>
      
       Servo myservo[6]; 
        
      int pinAttch = 0;    // variable to store pin attachment
      int servWrite = 0;    // variable to store servo writing
      
      void setup() {
        Serial.begin(9600);
        for(pinAttch = 2; pinAttch < 7; pinAttch++)
          {                                                
          myservo[pinAttch].attach(pinAttch);
          }  
        }
      
      void loop() {
      
      for(servWrite = 2; servWrite < 7; servWrite++)
        {                                                
         
        myservo[servWrite].write(80);
        delay(2000);
      
        }
      exit(0); 
      
      }```
      posted in Hardware
      numanx
      numanx
    • RE: Multiple Servos

      @gohan
      Debug print when changing the dimmer slider to different values.

      0;255;3;0;9;Eth: 0;0;3;0;2;
      0;255;3;0;9;Eth: 0;0;3;0;2;Get Version
      0;255;3;0;9;Eth: 0;1;1;1;3;7
      Servo changed. new state: 7
      0;255;3;0;9;Eth: 0;0;3;0;18;PING
      0;255;3;0;9;Eth: 0;1;1;1;3;21
      Servo changed. new state: 21
      0;255;3;0;9;Eth: 0;1;1;1;3;36
      Servo changed. new state: 36
      0;255;3;0;9;Eth: 0;0;3;0;18;PING
      0;255;3;0;9;Eth: 0;0;3;0;18;PING

      posted in Hardware
      numanx
      numanx
    • RE: Multiple Servos

      Ok so here is the sketch with the for cycles.
      But it still won't work. The servos are presented to the Controller but it won't make any move.
      I think the problem is with the void receive.
      I don't know how to change

         	digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
      

      for the servo

           myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * 1.8 * val); // sets the servo position 0-180
      
      // Debug
      #define MY_DEBUG
      // Partea cu Conexiunea la net
      #define MY_GATEWAY_ENC28J60
      #define MY_IP_ADDRESS 192,168,1,66
      #define MY_PORT 5003
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      #include <UIPEthernet.h>
      // Sfarsit parte
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <Servo.h>
      
      #define SERVO_1 4 // Arduino Digital I/O pin number for first servo (second on pin+1 etc)
      #define NUMBER_OF_SERVOS 2 // Total number of attached servos
      #define SERVO_MIN 0 // Fine tune your servos min. 0-180
      #define SERVO_MAX 180  // Fine tune your servos max. 0-180
      #define DETACH_DELAY 900 // Tune this to let your movement finish before detaching the servo
      //#define CHILD_ID 10   // Id of the sensor child
      
      //MyMessage msg(CHILD_ID, V_DIMMER);
      Servo myservo;  // create servo object to control a servo
      unsigned long timeOfLastChange = 0;
      bool attachedServo = false;
      bool state;
      
      void before()
      {
          for (int servo=1, pin_S=SERVO_1; servo<=NUMBER_OF_SERVOS; servo++, pin_S++) {
            myservo.attach(pin_S);
          }
      }
      
      void setup()
      {
        // Request last servo state at startup
          for (int servo=1, pin_S=SERVO_1; servo<=NUMBER_OF_SERVOS; servo++, pin_S++) {
            request(servo, V_DIMMER);
        }
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Servo", "1.0");
          // Register all sensors to gw (they will be created as child devices)
        for (int servo=1, pin_S=SERVO_1; servo<=NUMBER_OF_SERVOS; servo++, pin_S++) {
            present(servo, S_DIMMER);
        }
      }
      
      void loop()
      {
        if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
           myservo.detach();
           attachedServo = false;
        }
      }
      
      void receive(const MyMessage &message) {
        attachedServo = true;
        if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
           int val = message.getInt();
           myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * 1.8 * val); // sets the servo position 0-180
           // Write some debug info
           Serial.print("Servo changed. new state: ");
           Serial.println(val);
           }
         timeOfLastChange = millis();
      }
      
      
      posted in Hardware
      numanx
      numanx
    • RE: Multiple Servos

      Individually, thanks for your reply!

      posted in Hardware
      numanx
      numanx
    • Multiple Servos

      Hi there,
      Could someone help me with a sketch for running multiple servos.
      Like in the example for the Relay Actuator
      #define SERVO_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_SERVOS 1 // Total number of attached relays

      My current sketch is:

      
      // Debug
      #define MY_DEBUG
      // Partea cu Conexiunea la net
      #define MY_GATEWAY_ENC28J60
      #define MY_IP_ADDRESS 192,168,1,66
      #define MY_PORT 5003
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      #include <UIPEthernet.h>
      // Sfarsit parte
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <Servo.h>
      
      #define SERVO_DIGITAL_OUT_PIN 4
      #define SERVO_MIN 0 // Fine tune your servos min. 0-180
      #define SERVO_MAX 180  // Fine tune your servos max. 0-180
      #define DETACH_DELAY 900 // Tune this to let your movement finish before detaching the servo
      #define CHILD_ID 10   // Id of the sensor child
      
      MyMessage msg(CHILD_ID, V_DIMMER);
      Servo myservo;  // create servo object to control a servo
                      // a maximum of eight servo objects can be created Sensor gw(9,10);
      unsigned long timeOfLastChange = 0;
      bool attachedServo = false;
      bool state;
      
      void setup()
      {
        // Request last servo state at startup
        request(CHILD_ID, V_DIMMER);
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Servo", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_DIMMER);
      }
      
      void loop()
      {
        if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
           myservo.detach();
           attachedServo = false;
        }
      }
      
      void receive(const MyMessage &message) {
        myservo.attach(SERVO_DIGITAL_OUT_PIN);
        attachedServo = true;
        if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
           int val = message.getInt();
           myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * 1.8 * val); // sets the servo position 0-180
           // Write some debug info
           Serial.print("Servo changed. new state: ");
           Serial.println(val);
           }
         timeOfLastChange = millis();
      }
      

      Thanks!

      posted in Hardware
      numanx
      numanx
    • UPS Monitoring

      0_1494882379607_IMG_1089.JPG Hello,
      I have an UPS Vmark 650MK and I want to monitor it through Arduino and Domoticz.

      Can somebody help me with the code for reading the values from the panel?
      I have 3 LED's, Normal State, Backup and Fault.
      I want to read the values from those 3 LED's with HIGH and LOW / 1 and 0 in domoticz.

      Here is the schematic for the front panel.

      posted in Hardware
      numanx
      numanx
    • RE: Multiple Sensors on Gateway

      @gohan I understand what you are saying but if I am doing in that way I will spam the controller with the interrupts(flaps) right now it works like this
      if pin=0 send the state of the pin(the next update is when pin state changes), if pin=1 send the state and wait for 10 seconds for the next update.

      For the moment I have found a solution with millis[if(time%frequency==0)]:

      time=millis()/1000;
      if(time%10 ==0)
      

      Any suggestion for improving this part?

      posted in Troubleshooting
      numanx
      numanx
    • RE: Multiple Sensors on Gateway

      Thank you for your reply!
      The motion sensor part from the sketch works perfectly, the problem is with the temperature part.

      If I am using wait or sleep for temperature, arduino won't listen the motion sensor until the time elapses.

      If I am commenting the wait the sensor will spam the controller until the controller stop receiving data from arduino.

      posted in Troubleshooting
      numanx
      numanx
    • Multiple Sensors on Gateway

      Hello,
      I Want to use multiple sensors (motion sensor, temperature, rain sensor etc) on one Arduino MEGA.

      For the moment I use a module with 4 relays, 2 Dallas temperature sensors, 1 motion sensor(I would like to change the sketch to use multiple motion sensor as the temperature example) and the problem is that I have to prioritize the sensors, for example I need update for the temperature sensors every 20-30 seconds but the motion sensor should update instantly.

      Here is my code based on the MySensors examples.

      // Debug
      #define MY_DEBUG
      // Partea cu Conexiunea la net 
      #define MY_GATEWAY_ENC28J60
      #define MY_IP_ADDRESS 192,168,1,66  
      #define MY_PORT 5003   
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      #include <UIPEthernet.h>
      // Sfarsit parte
      
      
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      //==TEMP==
      #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
      #define ONE_WIRE_BUS 2 // Pin where dallase sensor is connected 
      unsigned long SLEEP_TIME = 20000; // Sleep time between reads (in milliseconds)
      #define MAX_ATTACHED_DS18B20 1
      OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      bool receivedConfig = false;
      bool metric = true;
      // Initialize temperature message
      MyMessage msgtemp(0,V_TEMP);
      //==TEMP==
      
      //==RELAY==
      #define RELAY_1  8  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 4 // Total number of attached relays
      #define RELAY_ON 0  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 1 // GPIO value to write to turn off attached relay
      //==RELAY==
      
      //==MOTION==
      
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID_MISCARE 15   // Id of the sensor child
      unsigned long SEND_FREQUENCY = 10;              // Minimum time between send (in seconds). We don't want to spam the gateway.
      long lastDebounce = 0;
      long debounceDelay = 500;
      unsigned long lastSend;
      unsigned long currentTime;
      unsigned int isTripped =0;
      
      // Initialize motion message
      MyMessage msgmiscare(CHILD_ID_MISCARE, V_TRIPPED);
      
      void before()
      {
        // Startup up the OneWire library
        sensors.begin();
      
        for (int sensor=1, pin=RELAY_1; 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 setup()  
      { 
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
          pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        lastSend = -1;
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Arduino SmartHub", "1.1");
        present(CHILD_ID_MISCARE, S_MOTION);
      
        for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_BINARY);
        }
        // Fetch the number of attached temperature sensors  
        numSensors = sensors.getDeviceCount();
      
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
           present(i, S_TEMP);
        }
      }
      
      void loop()     
      {     
      //==MOTION==
       
        currentTime = millis();
      // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
        Serial.println(tripped);
        Serial.println(currentTime-lastSend);
      if ((isTripped==0) &&(tripped==1)) {
          Serial.println("tripped");
          send(msgmiscare.set(tripped?"1":"0"));  // Send tripped value to gw
          lastSend=currentTime;
          isTripped=1;
        }
      if ((tripped==0) && (isTripped==1) && (currentTime - lastSend > 1000*SEND_FREQUENCY)){
          Serial.println("un-tripped");
          send(msgmiscare.set(tripped?"1":"0"));  // Send tripped value to gw
          lastSend=currentTime;
          isTripped=0;
        }
      
        // Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
        //wait(conversionTime);
      
        // Read temperatures and send them to controller 
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
      
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
          // Only send data if temperature has changed and no error
          #if COMPARE_TEMP == 1
          if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
          #else
          if (temperature != -127.00 && temperature != 85.00) {
          #endif
      
            // Send in the new temperature
            send(msgtemp.setSensor(i).set(temperature,1));
            // Save new temperatures for next compare
            lastTemperature[i]=temperature;
          }
        }
        wait(SLEEP_TIME);
       }
      
      void receive(const MyMessage &message) //Loop for receiving messages
      {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_STATUS) {
          // Change relay state
          digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
          // Store state in eeprom
          saveState(message.sensor, message.getBool());
          // Write some debug info
          Serial.print("Incoming change for sensor:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
        }
      }
      
      posted in Troubleshooting
      numanx
      numanx
    • RE: 💬 Building an Ethernet Gateway

      Maybe you have the ENC28J60 module which is different than w5100.

      try this code at the beginning of your sketch(using a mysensor's example)

      you have to change the ip to match your subnet and try to ping it.

      You can find the correct pinout here http://s3.electrodragon.com/wp-content/uploads/2011/11/172004eierrfwri9xsfamq-11.jpg

      #define MY_GATEWAY_ENC28J60
      #define MY_IP_ADDRESS 192,168,1,66  
      #define MY_PORT 5003   
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      #include <UIPEthernet.h>```
      posted in Announcements
      numanx
      numanx
    • RE: 💬 Building an Ethernet Gateway

      Could you send us a picture with the module?

      posted in Announcements
      numanx
      numanx