Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
C

ctodor

@ctodor
About
Posts
24
Topics
2
Shares
0
Groups
0
Followers
0
Following
1

Posts

Recent Best Controversial

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten You are right. It is not the same sketch. The previuos sketch seems to work fine (I used it just to make sure I am able to compile and upload).
    Now I'm trying to upload a sketch where the ardunio runs as gateway and this is what a need , a gateway that receives messages from a few magnetic door sensors.
    But please, don't waste your time with me. I think I'm going to write my simple protocol to do such a simple task.

    Thank you very much for your effort.

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten Yep, I was able to upload the sketch after I've set Tools -> USB-Mode -> CDC-Mode.
    Thank you for your help.

    Well, I think I rushed with the conclusion.
    Somehow, the bord is now in infinite boot loop:

    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.3.2
    ESP-ROM:esp32s3-20210327
    Build:Mar 27 2021
    rst:0x8 (TG1WDT_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
    Saved PC:0x4200d223
    SPIWP:0xee
    mode:DIO, clock div:1
    load:0x3fce3808,len:0x44c
    load:0x403c9700,len:0xbe4
    load:0x403cc700,len:0x2a68
    entry 0x403c98d4

    repetes over and over

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten
    Sorry for the late response, but I didn't had time to work on it until today.

    Yes, I was able to compile but not to upload. After "uploading", the Arduino NANO ESP 32 disconects from the PC.
    I must reset the board in order to be able to upload another sketch.

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten :+1:

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten Thx for the info.
    "Try the developement branch from the github": can you give me the url?

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    @eiten
    It is the SoilMoistSensor.ino skecth from MySensor example.

    *// Enable debug prints to serial monitor
    #define MY_DEBUG
    //#define MY_GATEWAY_ESP32

    // Enable and select radio type attached
    //#define MY_RADIO_RF24
    //#define MY_RADIO_NRF5_ESB
    #define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95

    #include <math.h> // Conversion equation from resistance to %
    #include <MySensors.h>

    // Setting up format for reading 3 soil sensors
    #define NUM_READS (int)10 // Number of sensor reads for filtering
    #define CHILD_ID 0

    MyMessage msg(CHILD_ID, V_LEVEL);
    uint32_t SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

    long buffer[NUM_READS];
    int idx;

    /// @brief Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
    typedef struct {
    int moisture; //!< Moisture
    long resistance; //!< Resistance
    } values;

    const long knownResistor = 4700; // Constant value of known resistor in Ohms

    int supplyVoltage; // Measured supply voltage
    int sensorVoltage; // Measured sensor voltage

    values valueOf[NUM_READS]; // Calculated moisture percentages and resistances to be sorted and filtered

    int i; // Simple index variable

    void setup()
    {
    // initialize the digital pins as an output.
    // Pin 6,7 is for sensor 1
    // initialize the digital pin as an output.
    // Pin 6 is sense resistor voltage supply 1
    pinMode(6, OUTPUT);

    // initialize the digital pin as an output.
    // Pin 7 is sense resistor voltage supply 2
    pinMode(7, OUTPUT);
    

    }

    void presentation()
    {
    sendSketchInfo("Soil Moisture Sensor Reverse Polarity", "1.0");
    present(CHILD_ID, S_MOISTURE);
    }

    void loop()
    {

    measure(6,7,1);
    Serial.print ("\t");
    Serial.println (average());
    long read1 = average();
    
    measure(7,6,0);
    Serial.print ("\t");
    Serial.println (average());
    long read2= average();
    
    long sensor1 = (read1 + read2)/2;
    
    Serial.print ("resistance bias =" );
    Serial.println (read1-read2);
    Serial.print ("sensor bias compensated value = ");
    Serial.println (sensor1);
    Serial.println ();
    
    //send back the values
    send(msg.set((int32_t)ceil(sensor1)));
    // delay until next measurement (msec)
    sleep(SLEEP_TIME);
    

    }

    void measure (int phase_b, int phase_a, int analog_input)
    {
    // read sensor, filter, and calculate resistance value
    // Noise filter: median filter

    for (i=0; i<NUM_READS; i++) {
    
    	// Read 1 pair of voltage values
    	digitalWrite(phase_a, HIGH);                 // set the voltage supply on
    	delayMicroseconds(25);
    	supplyVoltage = analogRead(analog_input);   // read the supply voltage
    	delayMicroseconds(25);
    	digitalWrite(phase_a, LOW);                  // set the voltage supply off
    	delay(1);
    
    	digitalWrite(phase_b, HIGH);                 // set the voltage supply on
    	delayMicroseconds(25);
    	sensorVoltage = analogRead(analog_input);   // read the sensor voltage
    	delayMicroseconds(25);
    	digitalWrite(phase_b, LOW);                  // set the voltage supply off
    
    	// Calculate resistance
    	// the 0.5 add-term is used to round to the nearest integer
    	// Tip: no need to transform 0-1023 voltage value to 0-5 range, due to following fraction
    	long resistance = (knownResistor * (supplyVoltage - sensorVoltage ) / sensorVoltage) ;
    
    	delay(1);
    	addReading(resistance);
    	Serial.print (resistance);
    	Serial.print ("\t");
    }
    

    }

    // Averaging algorithm
    void addReading(long resistance)
    {
    buffer[idx] = resistance;
    idx++;
    if (idx >= NUM_READS) {
    idx = 0;
    }
    }

    long average()
    {
    long sum = 0;
    for (int cnt = 0; cnt < NUM_READS; cnt++) {
    sum += buffer[cnt];
    }
    return (long)(sum / NUM_READS);
    }*

    Troubleshooting

  • Can not compile on Arduino Nano ESP 32
    C ctodor

    Hi,
    I'm trying to compile one of the example on Arduino Nano ESP32. (MySensors version 2.3.2)
    Am I doing something wrong?

    ***Compiling debug version of 'SoilMoistSensor' for 'Arduino Nano ESP32 (nano_nora)'

    esp32-hal-uart.c: In function uartSetPins

    esp32-hal-uart.c: 153:9: warning: 'return' with no value, in function returning non-void
    return
    ^~~~~~
    esp32-hal-uart.c:149: note declared here
    bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
    ^~~~~~~~~~~

    mysensors.h:61: In file included from
    SoilMoistSensor.ino:73: from

    MyHwESP32.cpp: In function bool hwInit()

    MyHwESP32.cpp: 30:48: error: no matching function for call to 'USBCDC::begin(long unsigned int, SerialConfig)
    MY_SERIALDEVICE.begin(MY_BAUD_RATE, SERIAL_8N1)

    USB.h:21: In file included from
    HardwareSerial.h:201: from
    arduino.h:184: from
    SoilMoistSensor.ino: from
    USBCDC.h:70: note candidate void USBCDC begin(long unsigned int)
    void begin(unsigned long baud=0)
    ^~~~~
    USBCDC.h:70: note candidate expects 1 argument, 2 provided

    SoilMoistSensor.ino: In function void loop()

    SoilMoistSensor.ino: 143:17: error: call of overloaded 'sleep(uint32_t&)' is ambiguous
    sleep(SLEEP_TIME)

    unistd.h:23: In file included from
    unistd.h:4: from
    pthread.h:25: from
    pthread.h:21: from
    gthr-default.h:48: from
    gthr.h:151: from
    atomicity.h:35: from
    basic_string.h:39: from
    string:52: from
    stdexcept:39: from
    array:39: from
    tuple:39: from
    functional:54: from
    Error compiling project sources
    HardwareSerial.h:49: from
    arduino.h:184: from
    Debug build failed for project 'SoilMoistSensor'
    SoilMoistSensor.ino: from***

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @mfalkvidd multimeter

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Update: it seems the problem was the DC-DC convertor. I have replace it with an extwrnal power source and now it works.
    I still don't understand what was wrong there because the voltage on the radio module was correct:3.3V

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @yury may be node radio is HCW somehow? no, it is not.

    I'll try to create a new board and give feedback.

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Unfortunately no schecma available. I've create the pcb on some website (don't know if is ok to say the site name here)
    The reset pad is indeed soldered, but the pad is not connected to anything.
    NSS->LV1->HV1->D10
    SCK->LV2->HV2->D13
    MOSI->LV3->HV3->D11
    MISO->LV4->HV4->D12
    DIO0->D2

    Btw. I've never reset the radio module

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Here are the pictures:
    pcb2.jpeg pcb1.jpeg

    But my question (maybe stupid question) is: It is possible the the radio module to be broken only on the "send side"?

    Thank you.

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @yury
    On the sende side (GW) I'm using Arduino Nano 5v and a logic shifter indeed.
    On the receiver side (Node) I'm using a "prebuild board" purchased from tindie.
    Btw, I think I bought from you, "easySensor" :grin: . Your devices works fine.

    The problem is on the "sender" side, built by me. I've already built two "boards" and both have the same problem. Sending doesn't work.

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @mfalkvidd the GW ia not totally mute, it sends at least the ACK, and also, the Node is not totallly deaf, it receives the ACK

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @mfalkvidd The node(sender), send a message with ack. The GW(receiver), receive the message and send the ack. The ack is never received on the node(sender) side.

    I've made the swap: I've load the gw(receiver) code to node(sender) and vice-versa. Technically, i've made the GWa sender and the Node a receiver.
    My GW (now a sender) is not able to send anything, or at least, the Node(now a receiver) doesn't receive anything.

    So it seems there is a HW issue on the "send side" of the GW.

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    @mfalkvidd exactly. the GW(receiver) was not able to send the ACK. in fact, the GW isn't able to send something. probably is a HW issue.

    1. do you have any ideea where/what should I investigate?
    2. it is possible that radio module on the GW to be broken only on the "send side"? I'm asking because I have two different GW with the same behaviour, so definatly I do something wrong.

    Thank you

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    More info: I've performed some tests using the RFM69_LowPowerLab and it seems my both radio modules work on both GW and Node. I was able to send and receive messages, but the was not received on the Node side

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Q. Is there a way to find out if the radio module is working?

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Radio version is CW
    MY_IS_RFM69HW is not defined

    Troubleshooting

  • Gateway doesn't receive any message from node
    C ctodor

    Antena added.

    Here is the log from GW

    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RRNGA---,FQ=16,REL=255,VER=2.3.2
    0;255;3;0;9;6 MCO:BGN:BFR
    --- before ---
    0;255;3;0;9;11 TSM:INIT
    0;255;3;0;9;17 TSF:WUR:MS=1
    0;255;3;0;9;27 TSM:INIT:TSP OK
    0;255;3;0;9;34 TSM:INIT:GW MODE
    0;255;3;0;9;37 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;45 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.3.2
    0;255;3;0;9;66 MCO:BGN:SETUP
    0;255;3;0;9;73 MCO:BGN:INIT OK,TSP=1
    --- loop ---

    Troubleshooting
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular