Sensor "persistence"?



  • Hi, I'm new to mysensors, like it very much!
    I noticed a weird (from my point of view) behavior of the examples available in the Arduino "mysensors" library.
    To get the examples working (like the Dimmable LED or Relay Actuator, etc.) with Domoticz for example this is what I need to do:

    1. Start Domoticz (on a raspberry pi)
    2. Connect the serial gateway (Arduino nano)
    3. Download the example firmware into the sensor (Arduino mini pro or nano)
      Fine so far, but if I power off the sensor and then power it on again it will not work any more, Domoticz and the gateway will not "see" the sensor until I re-flash the sensor.
      My question is how can I overcome that? What shall I do to avoid always re-flashing the sensor after powering it off?
      Interesting to say, if I power off the raspberry pi and the gateway then power on again both the sensor will still work assuming the sensor was not powered off.
      Seems like the gateway can only recognize the sensor once, after flashing the sensor code.
      Happens with both Domoticz and MyController.
      What am i doing wrong?

  • Admin

    What example firmware do you use for the sensor node?



  • I have used the Motion Sensor example, Relay Actuator, DimmableLED Actuator, Temperature ... I am uploading a few sketches:
    0_1496830979756_RelayActuator.ino
    0_1496831036727_TH_and_RELAY.ino
    0_1496831051014_TH1.ino
    0_1496831066368_MotionSensor.ino

    The gateway is this:
    0_1496831118872_GatewaySerial.ino

    Thanks!



  • If viewing my uploads is problematic, I'll copy paste some code below:

    The serial gateway:
    /**

    • The MySensors Arduino library handles the wireless radio link and protocol
    • between your home built sensors/actuators and HA controller of choice.
    • The sensors forms a self healing radio network with optional repeaters. Each
    • repeater and gateway builds a routing tables in EEPROM which keeps track of the
    • network topology allowing messages to be routed to nodes.
    • Created by Henrik Ekblad henrik.ekblad@mysensors.org
    • Copyright (C) 2013-2015 Sensnology AB
    • Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    • Documentation: http://www.mysensors.org
    • Support Forum: http://forum.mysensors.org
    • This program is free software; you can redistribute it and/or
    • modify it under the terms of the GNU General Public License
    • version 2 as published by the Free Software Foundation.

    • DESCRIPTION
    • The ArduinoGateway prints data received from sensors on the serial link.
    • The gateway accepts input on seral which will be sent out on radio network.
    • The GW code is designed for Arduino Nano 328p / 16MHz
    • Wire connections (OPTIONAL):
      • Inclusion button should be connected between digital pin 3 and GND
      • RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    • LEDs (OPTIONAL):
      • To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
      • RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
      • TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
      • ERR (red) - fast blink on error during transmission error or recieve crc error

    */

    // Enable debug prints to serial monitor
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW

    // Enable serial gateway
    #define MY_GATEWAY_SERIAL

    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif

    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE

    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP

    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN 3

    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300

    // Inverses the behavior of leds
    #define MY_WITH_LEDS_BLINKING_INVERSE

    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    #define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
    #define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED

    #include <MySensors.h>

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

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

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

    The Motion Sensor:
    /**
    The MySensors Arduino library handles the wireless radio link and protocol
    between your home built sensors/actuators and HA controller of choice.
    The sensors forms a self healing radio network with optional repeaters. Each
    repeater and gateway builds a routing tables in EEPROM which keeps track of the
    network topology allowing messages to be routed to nodes.

    Created by Henrik Ekblad henrik.ekblad@mysensors.org
    Copyright (C) 2013-2015 Sensnology AB
    Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors

    Documentation: http://www.mysensors.org
    Support Forum: http://forum.mysensors.org

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.


    REVISION HISTORY
    Version 1.0 - Henrik Ekblad

    DESCRIPTION
    Motion Sensor example using HC-SR501
    http://www.mysensors.org/build/motion

    */

    // Enable debug prints
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    #include <MySensors.h>

    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
    #define CHILD_ID 1 // Id of the sensor child

    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);

    void setup()
    {
    pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
    }

    void presentation()
    {
    // Send the sketch version information to the gateway and Controller
    sendSketchInfo("Motion Sensor", "1.0");

    // Register all sensors to gw (they will be created as child devices)
    present(CHILD_ID, S_MOTION);
    }

    void loop()
    {
    // Read digital motion value
    bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;

    Serial.println(tripped);
    send(msg.set(tripped ? "1" : "0")); // Send tripped value to gw

    switch (tripped) {
    case LOW:
    Serial.println("NO alarm");
    break;
    case HIGH:
    Serial.println("#####ALARM#####");
    break;
    }
    // Sleep until interrupt comes in on motion sensor. Send update every two minute.
    sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }

    Thermistor and Relay:
    /**
    The MySensors Arduino library handles the wireless radio link and protocol
    between your home built sensors/actuators and HA controller of choice.
    The sensors forms a self healing radio network with optional repeaters. Each
    repeater and gateway builds a routing tables in EEPROM which keeps track of the
    network topology allowing messages to be routed to nodes.

    Created by Henrik Ekblad henrik.ekblad@mysensors.org
    Copyright (C) 2013-2015 Sensnology AB
    Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors

    Documentation: http://www.mysensors.org
    Support Forum: http://forum.mysensors.org

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.


    REVISION HISTORY
    Version 1.0 - Henrik Ekblad

    DESCRIPTION
    Example sketch showing how to control physical relays.
    This example will remember relay state after power failure.
    http://www.mysensors.org/build/relay
    */

    // Enable debug prints to serial monitor
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE

    #include <MySensors.h>

    #define NODE_ID 5

    int _nominal_resistor = 4700;
    int _nominal_temperature = 25;
    int _b_coefficient = 3950;
    int _series_resistor = 5630;
    int _pin = 1;

    MyMessage msg(NODE_ID, V_TEMP);

    //uint8_t value = OPEN;
    int8_t temp = 25;

    #define RELAY_1 7 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 2 // Total number of attached relays
    #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

    void before()
    {
    for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
    // 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()
    {
    Serial.begin(115200);
    }

    void presentation()
    {
    // Send the sketch version information to the gateway and Controller
    sendSketchInfo("2xRelay+Thermistor", "1.0");

    present(NODE_ID, S_TEMP);

    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);
    }
    }

    void loop()
    {
    temp = measure_temperature();
    Serial.println(temp);
    send(msg.set(temp));
    sleep(5000);
    }

    void receive(const MyMessage &message)
    {
    // 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());
    }
    }

    int8_t measure_temperature()
    {
    // read the voltage across the thermistor
    float adc = analogRead(_pin);
    // calculate the temperature
    float reading = (1023 / adc) - 1;
    reading = _series_resistor / reading;
    float temperature;
    temperature = reading / _nominal_resistor; // (R/Ro)
    temperature = log(temperature); // ln(R/Ro)
    temperature /= _b_coefficient; // 1/B * ln(R/Ro)
    temperature += 1.0 / (_nominal_temperature + 273.15); // + (1/To)
    temperature = 1.0 / temperature; // Invert
    temperature -= 273.15; // convert to C
    if (! getControllerConfig().isMetric) temperature = temperature * 1.8 + 32;
    return int8_t(temperature);
    }


  • Admin

    could you please reformat your post, and add "code" tags to each chunk of code/ file? (use the "insert code-tag" button above the editor).

    It's a bit hard to see where one stops, and the next starts..


  • Admin

    Also try and stick with one piece of code, until you get that working, and understand what it does, before trying multiple sketches, etc. Take it step by step.. Instead of jumping all around 🙂

    A simple node, like an actuator, with a LED on the node, that you will try to turn on / off using domoticz



  • Sorry, i was just a bit too enthusiastic ... to see it all working :-), I'll reformat the post as you say.



  • So this is the gateway code:

    /**
    * The MySensors Arduino library handles the wireless radio link and protocol
    * between your home built sensors/actuators and HA controller of choice.
    * The sensors forms a self healing radio network with optional repeaters. Each
    * repeater and gateway builds a routing tables in EEPROM which keeps track of the
    * network topology allowing messages to be routed to nodes.
    *
    * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
    * Copyright (C) 2013-2015 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    *
    * Documentation: http://www.mysensors.org
    * Support Forum: http://forum.mysensors.org
    *
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * version 2 as published by the Free Software Foundation.
    *
    *******************************
    *
    * DESCRIPTION
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on seral which will be sent out on radio network.
    *
    * The GW code is designed for Arduino Nano 328p / 16MHz
    *
    * Wire connections (OPTIONAL):
    * - Inclusion button should be connected between digital pin 3 and GND
    * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    *
    * LEDs (OPTIONAL):
    * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
    * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
    * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
    * - ERR (red) - fast blink on error during transmission error or recieve crc error
    *
    */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    #define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    #define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors
    }
    
    void loop()
    {
    	// Send locally attached sensor data here
    }```


  • And this is my temperature sensor code (I'm using a thermistor):

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    #define MY_RADIO_NRF24
    
    #include <MySensors.h>
    
    #define NODE_ID 0
    
    int _nominal_resistor = 4700;
    int _nominal_temperature = 25;
    int _b_coefficient = 3950;
    int _series_resistor = 5630;
    int _pin = 1;
    
    MyMessage msg(NODE_ID, V_TEMP);
    
    //uint8_t value = OPEN;
    int8_t temp = 25;
    
    void setup()
    {
      Serial.begin(115200);
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Thermistor", "1.0");
      present(NODE_ID, S_TEMP);
    }
    
    void loop()
    {
      temp = measure_temperature();
      Serial.println(temp);
      send(msg.set(temp));
      sleep(3000);
    }
    
    int8_t measure_temperature()
    {
      // read the voltage across the thermistor
      float adc = analogRead(_pin);
      // calculate the temperature
      float reading = (1023 / adc)  - 1;
      reading = _series_resistor / reading;
      float temperature;
      temperature = reading / _nominal_resistor;     // (R/Ro)
      temperature = log(temperature);                  // ln(R/Ro)
      temperature /= _b_coefficient;                   // 1/B * ln(R/Ro)
      temperature += 1.0 / (_nominal_temperature + 273.15); // + (1/To)
      temperature = 1.0 / temperature;                 // Invert
      temperature -= 273.15;                         // convert to C
      if (! getControllerConfig().isMetric) temperature = temperature * 1.8 + 32;
      return int8_t(temperature); 
    }```
    
    I start Domoticz, enter the Gateway setup and delete every node while the sensor is powered off. 
    I power on the sensor (connect the USB cable to my laptop) and nothing happens, I click refresh on the nodes but no nodes shows up, the RX and TX LEDs on the gateway do not blink.
    Then I reflash (upload) the code above and suddenly the RX and TX LEDs on the Gateway start blinking and Domoticz recognizes my sensor.
    It is like if I power off the sensor it will not be recognized unless I upload the sensor code again.


  • Sorry ... still learning how to use the Insert Code Block 🙂
    I start Domoticz, enter the Gateway setup and delete every node while the sensor is powered off.
    I power on the sensor (connect the USB cable to my laptop) and nothing happens, I click refresh on the nodes but no nodes shows up, the RX and TX LEDs on the gateway do not blink.
    Then I reflash (upload) the code above and suddenly the RX and TX LEDs on the Gateway start blinking and Domoticz recognizes my sensor.
    It is like if I power off the sensor it will not be recognized unless I upload the sensor code again.


  • Admin

    Try a simpler approach, use a serial terminal to access the gateway, and check the messages that is coming in there.

    Next check the serial port on the node, and check if it indicates any errors etc, both on first power up, and on second/third/fourth etc.



  • OK, I tried to power ON the sensor 5 times, I opened the Arduino serial monitor every time and waited a couple of minutes, the terminal window was empty every time like the sensor has no serial output.
    Sixth time I hit the upload button in Arduino and in a few seconds the sensor starts working and this is what I can see in the terminal window:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSF:SID:OK,ID=2
    14 TSM:FPAR
    51 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    411 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    416 TSF:MSG:FPAR OK,ID=0,D=1
    2058 TSM:FPAR:OK
    2059 TSM:ID
    2060 TSM:ID:OK
    2062 TSM:UPL
    2065 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2071 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2076 TSF:MSG:PONG RECV,HP=1
    2078 TSM:UPL:OK
    2080 TSM:READY:ID=2,PAR=0,DIS=1
    2084 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2092 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2099 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2107 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2113 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2120 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=10,sg=0,ft=0,st=OK:Thermistor
    2129 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    2138 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
    2143 MCO:REG:REQ
    2147 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2153 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2158 MCO:PIM:NODE REG=1
    2160 MCO:BGN:STP
    2162 MCO:BGN:INIT OK,TSP=1
    27
    2166 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:27
    2172 MCO:SLP:MS=3000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2178 MCO:SLP:TPD
    2180 MCO:SLP:WUP=-1
    27
    2184 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:27
    2190 MCO:SLP:MS=3000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2195 MCO:SLP:TPD
    2197 MCO:SLP:WUP=-1
    27
    2201 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:27
    2207 MCO:SLP:MS=3000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2212 MCO:SLP:TPD
    2214 MCO:SLP:WUP=-1
    27
    2219 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:27
    2225 MCO:SLP:MS=3000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2230 MCO:SLP:TPD
    2231 MCO:SLP:WUP=-1```

  • Admin

    what hardware do you use for the node?



  • The node is an Arduino Mini - it is not an Arduino Mini Pro as reccomended, true!
    But I'll try soon with an Arduino Nano as a node.
    The gateway is an Arduino nano.
    on The gateway side the serial monitor only shows

    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.1.1
    

    no matter how many times I power ON and OFF the sensor.
    But after I reflash the sensor then the Gateway serial output is:

    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.1.1
    2;255;3;0;11;Thermistor
    2;255;3;0;12;1.0
    2;0;0;0;6;
    2;0;1;0;0;27```

  • Admin

    Just a thought..

    Program a simple blinking sketch in your node, see if the LED is blinking (this is without mysensors at all!)

    Now try powercycling it a couple of times, does it start blinking?

    If not, then there is a problem with your arduino mini.



  • OK, I'll try that too, thanks!



  • Amazing! You were absolutely right! I tried a simple LED blink like below, it only works once after the code upload. No matter how many times I power cycle after that, it will not work any more. What could be wrong with this Arduino Mini? It is the original Arduino Mini from Farnell ...

    /*
      Blink
      Turns on an LED on for one second, then off for one second, repeatedly.
    
      Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO 
      it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
      the correct LED pin independent of which board is used.
      If you want to know what pin the on-board LED is connected to on your Arduino model, check
      the Technical Specs of your board  at https://www.arduino.cc/en/Main/Products
      
      This example code is in the public domain.
    
      modified 8 May 2014
      by Scott Fitzgerald
      
      modified 2 Sep 2016
      by Arturo Guadalupi
      
      modified 8 Sep 2016
      by Colby Newman
    */
    
    
    // the setup function runs once when you press reset or power the board
    void setup() {
      // initialize digital pin LED_BUILTIN as an output.
      pinMode(8, OUTPUT);
    }
    
    // the loop function runs over and over again forever
    void loop() {
      digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);                       // wait for a second
      digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);                       // wait for a second
    }```


  • Many thanks nevertheless:-)
    I use Arduino 1.8.2


  • Admin

    I have no idea what could be wrong with it..

    Have you checked the soldering of the board? Tried another powersupply?



  • Forgot to tell I have a few such Arduino Mini, all have the same issue!
    Might have something to do with both the way I have connected the power and the reset, like here, "Connecting the Arduino Mini and Mini USB Adapter":

    https://www.arduino.cc/en/Guide/ArduinoMini

    Power to the Arduino (+5V) comes from the USB Adapter while reset goes through a capacitor.
    I will abandon this setup and use a nano based sensor for now.



  • I think the RESET could be the problem but I cannot find the schematics of this Arduino Mini to determine the precise source of the problem.
    I'll use the Nano or the Pro in the future ... but thanks anyway, it was instructive!


  • Admin

    Have you tried just supplying it with 5V, without the reset attached?



  • Yes, I did, no change.
    I have removed the capacitor on the RESET pin and I have pressed the RESET button on the Mini, nothing happens to my surprise.
    I shall try to use a different 5V power supply instead of supplying the Mini from the USB adapter. Eventually remove every wire between the Mini and the USB adapter and use an external 5V supply.



  • I have re-wired everything and it works now if I remove the wire from the USB Adapter "EXT. RESET" signal to the 100nF capacitor connected to the Arduino RESET pin - after the code upload.
    I guess we can say "solved", I still can use the Arduino Mini if I remove either the RESET capacitor or the wire to this capacitor, like in the attached picture ... nice help on this forum anyway:-)

    0_1496903986267_Arduino_Mini.JPG


  • Admin

    @iahim67

    thanks for the feedback, and good that you got it working finally 🙂



  • One more thing :simple_smile: , this is the Arduino Mini schematics if someone needs it (not very easy to find):

    0_1496905610194_Arduino_Mini_Schematics.JPG


Log in to reply
 

Suggested Topics

33
Online

11.4k
Users

11.1k
Topics

112.6k
Posts