💬 Easy/Newbie PCB for MySensors



  • @sundberg84 I have a "newby" question about how to use the Extra's part of the board. If I want to connect a DS18B20 sensor per example can I just solder it on the extra area and connect is with some wires to the pinout I need?
    Asking this because I did this with the i2c sensor on the board discussed here. having a wire form the extras towards the arduino i2c pins directly. Later I discovered that the i2c pins are also on the board.
    So how to deal with this?


  • Mod

    you can add a wire to the I2C pins, in your case you just need a short wire to a digital pin that are just next to the Extra area



  • @gohan said in 💬 Easy/Newbie PCB for MySensors:

    you can add a wire to the I2C pins, in your case you just need a short wire to a digital pin that are just next to the Extra area

    Ok. And if attaching a DS18B20 I have a pull up resistor soldered on the board. Than it is also just the digital pin I need from the board? D3 I think?


  • Hardware Contributor

    @mr_sensor with a DS18B20 temp sensor I just solder it to the MysX pins (D3, Gnd and VCC) directly and populate the resistor for D3.



  • @sundberg84 Yes thanks I did so. But do not get any temp read out? Have al in space also the 4,7 k resistor.

    this is my sketch:

    [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.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0: Henrik EKblad
     * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
     * 
     * DESCRIPTION
     * This sketch provides an example of how to implement a humidity/temperature
     * 
     * Dallas temperature sensor DS18B20
     *  
     * For more information, please visit:
     * http://www.mysensors.org/build/humidity
     * 
     HTU21D Humidity Sensor
     Hardware Connections (Breakoutboard to Arduino):
     -VCC = 3.3V
     -GND = GND
     -data  = D3 met pcb 470 uf resistor
     */
    
     
    #define MY_NODE_ID 4
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    
    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached 
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
     
    #include <MySensors.h>
    #include <OneWire.h>  
    //#include <Wire.h>
    #include <SPI.h>
    #include <DallasTemperature.h>
    
    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    //static const uint8_t FORCE_UPDATE_N_READS = 10;
    
    #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    //unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    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;
    
    #define CHILD_ID_TEMP 0
    #define CHILD_ID_BATTERY 1
    #define CHILD_ID_VOLT 2
    //#define CHILD_ID_PRCNT 3
    
    //float lastTemp;
    //float lastHum;
    
    //uint8_t nNoUpdatesTemp;
    //uint8_t nNoUpdatesHum;
    //boolean metric = true;
    
    
    
    
    void presentation()  
    { 
     // Send the Sketch Version Information to the Gateway                                                                                                                     
      sendSketchInfo("Temperature Sensor", "1.1");      
       
     // Register all sensors to gw (they will be created as child devices)                                                                                                     
    //  present(CHILD_ID_HUM, S_HUM);                                                                                                                                          
      present(CHILD_ID_TEMP, S_TEMP);
       present(CHILD_ID_BATTERY, S_MULTIMETER);                                                                                                                                         
      //metric = getControllerConfig().isMetric;
    
    // 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);
      }
       
    }
    
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
                                                                                                                                                      
    unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)  60000                                                                                           
    static int oldBatteryPcnt = 0;                                                                                                                                                                        
                                                                                                                                                                   
                                                                                                                                                                            
    //Create an instance of the object                                                                                                                                          
    
      MyMessage msg(0,V_TEMP);                                                                                                                                                                                                                                                                                                                           
    //MyMessage msgHum(CHILD_ID_HUM, V_HUM);                                                                                                                                      
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);                                                                                                                                   
    MyMessage msgBattery(CHILD_ID_BATTERY, V_VOLTAGE);
    //MyMessage msgBattery(CHILD_ID_BATTERY, V_PRC);
    
    
    void setup() {
        // Startup up the OneWire library
      sensors.begin();
    
         // use the 1.1 V internal reference
    #if defined(__AVR_ATmega2560__)
        analogReference(INTERNAL1V1);
    #else
        analogReference(INTERNAL);
    #endif
    
    // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    
    } 
                                                                                                                                                                                                                                                                                                                                                     
    void loop()                                                                                                                                                                 
    {                                                                                                                                                                           
    
    
    // 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)
      sleep(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(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }
    
    
    // some delay here
       delay(500);
    
       // get the battery Voltage
         
        int sensorValue = analogRead(BATTERY_SENSE_PIN);
        delay(500);
    #ifdef MY_DEBUG
        Serial.println(sensorValue);
    #endif
    
        // 1M, 470K divider across battery and using internal ADC ref of 1.1V
        // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
        // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
        // 3.44/1023 = Volts per bit = 0.003363075
        int batteryPcnt = sensorValue / 10;
    
    #ifdef MY_DEBUG
        float batteryV  = sensorValue * 0.003363075;
        Serial.print("Child ID ");
        Serial.print(CHILD_ID_BATTERY);
        Serial.print("Battery Voltage: ");
        Serial.print(batteryV);
        Serial.println(" V");
    
        Serial.print("Battery Percent: ");
        Serial.print(batteryPcnt);
        Serial.println(" %");
    #endif
    
        if (oldBatteryPcnt != batteryPcnt) {
            // Power up radio after sleep
                  
            sendBatteryLevel(batteryPcnt);
            oldBatteryPcnt = batteryPcnt;
        } 
                                                                                                                                                                          
      sleep(SLEEP_TIME); //sleep a bit  
                                                                                                                                           
    }
    [/code]```
    
    

    | / |_ / | ___ _ __ ___ ___ _ __ ___
    | |/| | | | _
    \ / _ \ _ \/ __|/ _ \|
    / |
    | | | | |
    | |
    | | / | | _ \ _ | | \�
    |
    | |
    |_, |/ _|| ||/_/|| |/
    |
    _/ 2.2.0

    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSM:INIT:STATID=4
    38 TSF:SID:OK,ID=4
    40 TSM:FPAR
    43 TSM:FPAR:STATP=0
    45 TSM:ID
    47 TSM:ID:OK
    47 TSM:UPL
    53 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    67 TSF:MSG:READ,0-0-4,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    71 TSF:MSG:PONG RECV,HP=1
    75 TSM:UPL:OK
    77 TSM:READY:ID=4,PAR=0,DIS=1
    116 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
    2125 TSF:MSG:SEND,4-4-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=1,st=OK:2.2.0
    2138 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4177 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=OK:Temperature Sensor
    4196 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.1
    4214 TSF:MSG:SEND,4-4-0-0,s=0,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
    4227 TSF:MSG:SEND,4-4-0-0,s=1,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
    4235 MCO:REG:REQ
    4237 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    6246 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    8255 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    10264 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    12273 MCO:BGN:STP
    12275 MCO:BGN:INIT OK,TSP=1
    12279 MCO:SLP:MS=94,SMS=0,I1=255,M1=255,I2=255,M2=255
    12285 TSF:TDI:TSL
    12288 MCO:SLP:WUP=-1
    12290 TSF:TRI:TSB
    915
    Child ID 1Battery Voltage: 3.08 V
    Battery Percent: 91 %
    13297 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:91
    13305 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    13312 TSF:TDI:TSL
    13314 MCO:SLP:WUP=-1
    13316 TSF:TRI:TSB
    13320 MCO:SLP:MS=94,SMS=0,I1=255,M1=255,I2=255,M2=255
    13326 TSF:TDI:TSL
    13328 MCO:SLP:WUP=-1
    13330 TSF:TRI:TSB
    826
    Child ID 1Battery Voltage: 2.78 V
    Battery Percent: 82 %
    14340 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:82
    14346 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    14352 TSF:TDI:TSL


  • Hardware Contributor

    @mr_sensor - it looks ok except the temp sensor. Hard to say but doulecheck your wiring!




  • Hardware Contributor

    @mr_sensor looks right. Upload a sketch without MySensors from the temp library



  • @sundberg84 I run the "single" sketch from temp library and this is what I get:

    Dallas Temperature IC Control Library Demo
    Locating devices...Found 0 devices.
    Parasite power is: OFF
    Unable to find address for Device 0
    Device 0 Address: 0000000000000000
    Device 0 Resolution: 0
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    Requesting temperatures...DONE
    Temp C: -127.00 Temp F: -196.60
    


  • @mr_sensor Lets see your code


  • Hardware Contributor

    @mr_sensor ok, so either it's not wired correctly (but it looks good), or it's a sensor failure or it's a failure between the sensor and the Arduino.

    You can try to measure continuity from sensor to VCC / Gnd and D3 on the atmega.



  • @mr_sensor And show a pic of the bottom of the board with the sensor.



  • @dbemowsk said in 💬 Easy/Newbie PCB for MySensors:

    @mr_sensor And show a pic of the bottom of the board with the sensor.

    0_1519755501591_IMG_6065.jpg


  • Hardware Contributor


  • Mod

    In general I'd say that more soldering practice is needed 😅



  • @gohan Not a solder problem I think. This is no short on the board it is just the angel of the picture hiding the gap underneath. 🙂
    tried the same set-up with an other dallas sensor. still the same result.


  • Hardware Contributor

    @mr_sensor - still, very strange. I have the exact same setup and it works without issues.
    Try to do a continuity test between the middle pin of the sensor (touch the leg, not any solder-point) and D3 on the atmega328 chip (Do not power the node while doing this).

    0_1519810011892_1e9fc234-81eb-4f75-8028-08965b242be0-image.png0_1519810472076_a3464956-8e9d-429c-bef4-8612b6e8a321-image.png

    Try to do the same continuity test between the middle leg on the sensor and GND + VCC on the PCB.

    Also, please report back the voltage between VCC and GND on the sensor. (Same, measure on the legs)
    0_1519810190951_740a8a17-9bbd-43cd-bdc1-07e9baa5fe19-image.png



  • feeding too much solder into the joint before you've heated up both sides, and melting the solder on the iron instead of the pins or board before those parts are hot enough.


  • Hardware Contributor

    @mr_sensor said in 💬 Easy/Newbie PCB for MySensors:

    @gohan Not a solder problem I think. This is no short on the board it is just the angel of the picture hiding the gap underneath. 🙂
    tried the same set-up with an other dallas sensor. still the same result.

    Still you should read and watch a few videos on YouTube about how to make good solder joints, because your board is not really pretty at the moment 😉
    It's not difficult to make proper "volcano" shaped solder joints when you have learnt the few tricks you need, and it avoids a lot of hair pulling!



  • @sundberg84 I did measure some things. Also replaced the arduino to be sure that it was working (did nt make a difference)

    I found 3,3 volt between vcc and gnd on the sensor. Also between the data-pin of the sensor and the arduino there is continuity.
    The middle leg on the sensor and GND + VCC on the PCB is not resulting in any continuity(I am not really sure if I did measure it in the right way. It is a bit hard to get gnd + vcc on the multimeter pin together).


  • Mod

    have you tried all your setup on a breadboard?


  • Hardware Contributor

    @mr_sensor - ok, then we can exclude PCB and wiring issues. Next is either software or sensor/pro mini failure. I would re-install the library or try anohter one as first thing to do because you said you have tried another sensor and pro mini right?



  • @sundberg84 I tried with other libraries, without success. Also changed the sensor for a new one, without any success. Only thing that made me wondering, now the sensor is on 3,3 volt? When looking at the net for samples, etc. some of them refer to 5volt? So could that be the problem here? Not providing 5 volt to the sensor?


  • Hardware Contributor

    @mr_sensor - no 3.3v is enough:

    0_1520259286284_05be0ac6-fb03-47f8-9938-df9e8b13b156-image.png

    This is really strange... can you confirm it is the right markings on your TO-92 package (actually a temp sensor)?

    0_1520259592581_a2305f4d-04cd-4a60-8bfb-057e3bbbb4fe-image.png

    You could try changing the pin to exclude a pro mini failure (if you have not swapped that one already)

    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
    #define MAX_ATTACHED_DS18B20 16

    You can also test my Ds18b20 code from here but you need to change from RFM69 radio to Nrf24l01+ radio,
    https://github.com/sundberg84/HomeAutomation/blob/master/Sketches MySensors RFM69 radio/RFM_BeerCooler_Temp/RFM_BeerCooler_Temp.ino

    I would also try a bare pro mini + the temp sensor + resistor on a breadboard powered with 3.3v from ftdi adapter.

    I also need you to doublecheck the resistance on that pull-up resistor:
    0_1520260014260_40ed22d0-e2b3-4a27-8a35-2ce7a9648688-image.png

    Im having a hard time to see the exact colors but it that is Yellow, Brown, Gold, Gold that means you have a 4.1 ohm resistor to VCC which is pretty much a short and might have broken the temp sensor. Use a 10k or 56k.



  • @sundberg84 Coincidentally I yesterday had a FTDI powered 3v3 Pro-Mini hooked to a RJ11 socket to test and retrieve addresses using the OneWire.h from two plugged DS18B20 devices to add to those in the chain here already, the resistor was 4k7. The chain of now 12 devices also uses a 4k7 and continues to work flawlessly.



  • @sundberg84 Ok did try with just the bare pro mini + the temp sensor + resistor on a breadboard powered with 3.3v from ftdi adapter.
    And guess what? Than I get the temperature reading 🙂 So why is it not working on the board than? I Will check the soldering again and see if I can solder a new board.

    Dallas Temperature IC Control Library Demo
    Locating devices...Found 1 devices.
    Parasite power is: OFF
    Device 0 Address: 28FF5849011704D8
    Device 0 Resolution: 9
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE
    Temp C: 21.00 Temp F: 69.80
    Requesting temperatures...DONE ```
    
    So both sensor and arduino are working?

  • Hardware Contributor

    Promising! Then you know that hardware is ok... you just have to continue debugging.
    Use the same hardware and software for the PCB. It should work just fine! (I have several working for years now).



  • Hi All,

    Thanks Sundberg84 for creating a board where I can knock out sensors in the matter of minutes instead of hours. 🙂

    That being said, I actually spent many hours on the weekend trying to get my first board to work so I thought that I'd share so it could benefit others.

    I was setting up a 3v3 board with 2 x AA batteries with the battery pad jumpered and using the 3v3 booster. I triple checked the board for continuity.

    I was suffering from !TSM:FPAR:FAIL messages when firing up the node using the FTDI adaptor. I found that the board didn't work when both the battery and FTDI were supplying power.

    Here are my lessons:

    • You need to have a battery connected. This is required to power the radio, as it radio isn't powered by the FTDI adapter
    • You need to remove power from the FTDI adapter. I couldn't disable power on my FTDI adapter so I had to use jumper wires for CTS, DTR, RXD, TXD, and GND between the adapter and the ProMini.

    Thanks again, and I look forward to knocking out some nodes super quick.

    Cheers,
    Simon.


  • Hardware Contributor

    @dbemowsk what I'm worried about is the booster so close to the radio. What do you think @dbemowsk @scalz @Nca78 ?

    alt text


  • Mod

    how about swapping the Extra and Booster section? It makes it cleaner to connect the extra pins to the pro mini.


  • Hardware Contributor

    @sundberg84 i think you already know the answer 😉 (not great regarding emi radiation for example,especially with cheap regulators and inductors.., one downside of relying on external parts,modules but i know your point it's for noobs..)
    I seem to see another thing for your nrf ant, not sure if your nrf 24 goes outside the pcb,if it doesn't then this means you have gnd pour under the ant, not great too in this case



  • @gohan & @sundberg84 For that matter, what about just swapping the Bat.measurer and the booster. You are going to get interference with the inductor being directly next to the antenna.


  • Hardware Contributor

    Thanks guys! (@scalz @gohan @dbemowsk !)
    I think I will relocate the booster... should have thought about that before.
    The NRF antenna goes outside the PCB just like rev 9 so no ground plain for the antenna in normal cases. I might revert it back to allow the PCB to be in range for all directions. Good point.

    I will start with to swap extra and booster to get as much space in between the antenna and inductor.


  • Hardware Contributor

    Something like this...

    0_1521917114887_7092eb47-33ac-4a9c-baf9-c3fd3cd5c658-image.png



  • Would something like this be possible? It would give users that little bit of extra room in the proto area.
    0_1521918858785_911e7f1a-5943-4a40-a49c-e99853681070-image.png


  • Hardware Contributor

    Hi all!

    This has now been update to Rev 10.
    New revision has been sent to PCB manufacturer but It will take some days for them to update their Gerber. (When you order, make sure it says M.Rev 6!

    0_1528107591933_8daa3f55-a3e9-456a-86fe-cbb70d43c8fd-image.png

    Openhardware page has been updated, let me know if you find anything strange.

    RFM69 version will be updated soon as well.



  • Can you please share design of version 9 of the Easy PCB NRF24 edition. I bought 10 pieces a while ago but just decided to use couple. Thank you.


  • Hardware Contributor

    @apl2017 what kind of info are you looking for ? Schematics ?

    0_1528351654852_Rev9 Schem.jpg



  • Just schematic and board layout, exactly what you placed, if possible in a bit better resolution. Thanks a lot!


  • Hardware Contributor

    @apl2017 traveling for my work until next week but will post then.



  • @sundberg84 I just finished my first battery sensor node based on the Easy PCB Rev 9. I have two questions i hope you can help me with:

    The first is about the battery measurement. Because i didn't have a 0.1 uf lying around i used an 0.2 uf capacitor. I am using the following script to measure the battery.

    //=========================
    // BATTERY VOLTAGE DIVIDER SETUP
    // 1M, 470K divider across battery and using internal ADC ref of 1.1V
    // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
    // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
    // 3.44/1023 = Volts per bit = 0.003363075
    #define VBAT_PER_BITS 0.003363075  
    #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
    #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
    int batteryPcnt = 0;                              // Calc value for battery %
    int batLoop = 0;                                  // Loop to help calc average
    int batArray[3];                                  // Array to store value for average calc.
    int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
    //=========================   
    
    
       // Calculate the battery in %
       float Vbat  = sensorValue * VBAT_PER_BITS;
       int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
       Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
    

    Do i need to change anything in the formula? Because i getting reading around the 130%

    Requesting temperature...DONE
    Temperatuur : 26.62 Degrees C
    11935 TSF:MSG:SEND,25-25-0-0,s=5,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:26.6
    Battery percent: 131 %
    Battery Voltage: 3.35 V
    Sleep...
    12945 MCO:SLP:MS=900000,SMS=0,I1=0,M1=1,I2=254,M2=1
    12955 TSF:TDI:TSL
    
    

    If i use the following method:

    //----
       // 1M, 470K divider across battery and using internal ADC ref of 1.1V
       // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
       // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
       // 3.44/1023 = Volts per bit = 0.003363075
       float batteryV  = sensorValue * 0.003363075;
       int batteryPcntNEW = sensorValue / 10;
    
       Serial.print("Battery percent: ");
       Serial.print(batteryPcntNEW);
       Serial.println(" %");
    //----
    

    I am getting: (this is expected, because batteries are new)

    Battery percent: 99 %
    Sleep...
    12945 MCO:SLP:MS=900000,SMS=0,I1=0,M1=1,I2=254,M2=1
    12955 TSF:TDI:TSL
    
    

    My second question is about casing: any tips on which case to use which fit your board and a battery pack? and is as small as possible? Do you perhaps have links of your favourite (Chinese) sellers?


  • Hardware Contributor

    @mister_ik said in 💬 Easy/Newbie PCB for MySensors:

    @sundberg84 I just finished my first battery sensor node based on the Easy PCB Rev 9. I have two questions i hope you can help me with:

    The first is about the battery measurement. Because i didn't have a 0.1 uf lying around i used an 0.2 uf capacitor. I am using the following script to measure the battery.

    Do i need to change anything in the formula? Because i getting reading around the 130%

    Hello, this is normal as your maximum voltage is set at 3V, while initial voltage of an alkaline AA/AAA cell can be a bit over 1.6V. But voltage will quickly drop toward 1.5V (much faster than remaining capacity), so the best instead of changing the maximum voltage is to check the value of batteryPcnt and if it's over 100, just set it to 100.
    Make sure the VBAT_PER_BITS makes you read a voltage that matches the voltage you read with your multimeter, else fix it. Each Atmega is different so you need to calibrate each board.

    For the capacitor it's not a problem, it's just made to stabilize the voltage as it's very sensible to electrical noise. Twice the value will be good enough for this job 🙂


  • Hardware Contributor

    @Nca78 thanks for the help/answer. 😀 About the case I'm using some plastic electronic cases from my hardware shop but @ openhardware you will find some links to 3d projects.

    Let us know @Mister_ik if you need anything else.



  • No sign of the new revision yet:

    0_1528708713299_3aff98ea-8698-4521-8901-7093de8edb7e-image.png


  • Hardware Contributor

    @mickecarlsson - not on the RFM69 version, no. PCBway has updated the NRF24 version so a good sign.
    Something went wrong with the update of the RFM69 version so I had to activate it 21hours ago:

    0_1528709688387_8c18a333-5e8f-4f63-8fd5-be26c87c4b18-image.png

    Lets hope PCBway picks this up today.



  • @sundberg84
    OK, good news. I will check it tomorrow and hopefully order a batch (or two).



  • Still no rev 6 on itead or pcbway for rfm69 version 😞


  • Hardware Contributor

    @mickecarlsson no something went wrong so Rev 5 is ok to order! This is easy rev 10!



  • Hello @sundberg84

    What if feeding a Pro Mini 3.3V (EasyPCB Nrf24l01+ edition rev 10) with regulated power on RAW. (I have 5 VDC). I guess I can feed the radio via the VCC terminal instead of using an external voltage regulator. Can the EasyPCB be used in such a setup?

    Edit: To answer my own question. I should RTFM 👊

    It states clearly that:

    "(If you are using regulated 3.3v, use 5v instructions but skip the voltage regulator and bypass this with a jumper between Vin and Vout"

    Thanks anyway!



  • This post is deleted!


  • @รอเร-อ I have a similar need, but not exactly the same.
    My power route is:
    18650 Lipo (2.7 - 4.2 V) -> TP4056 (charger) -> Booster (5V) -> Raw pin of pro mini 3.3V -> Vcc of pro mini 3.3V -> Radio (NRF24)

    In my case the easy newbie pcb is not directly suitable because the Vout of the Booster is connected to Vcc instead of raw.

    So my idea is to use a modified version of the easy newbie pcb with the schematic posted here
    in order to have more flexibility in the power options.

    Actually I don't have the skills to design a pcb, but maybe, if the idea is good, someone else could design it.

    This schematic is compatible with all the power options actually supported by the easy newbie pcb, and supports also new possibility, simply changing a couple of jumpers


  • Hardware Contributor

    Hello @franz-unix, can't you just bend the output pin of the booster at 90° and solder a wire from it to the raw pin ?



  • @nca78 Yes it should work.

    If I connect the output of the tp4056 to the gnd and reg input of the screw terminal of the easy newbie pcb and then I run a wire from the Vout of the booster to the raw input of the screw terminal, the final result is also quite clean and it is not necessary to solder the wire directly on the pro mini.

    I think that, in this case, the reg jumper must be NOT shortened.



  • Hi,

    I ordered 10 PCBs using "Order from PCBWay" button. It only asked me about PayPal card and din't require any registration on PCBWay. So, everything looks good, PayPal transaction is completed. Can somebody tell me please how can I track it? Probably I'm missing tracking option somewhere... Thank you!

    P.S.
    Cant wait to try it out. 🙂


  • Hardware Contributor

    @zelen I'm not sure. You didn't receive any email? I normally get a email once they are finished and shipped with tracking.



  • This post is deleted!


  • @sundberg84 thank you for clarification. I expected email right after making an order. So, I will wait for finishing production and shipment.



  • I use some of old rev8 boards. I have noticed that I use a ceramic capacitor instead of an electric capacitor compared to the images for the battery measurement. Does it matter? Or should I replace the ceramic capacitor (104) with an electric capacitor?


  • Hardware Contributor

    @harrdy should work just fine.


  • Mod

    @harrdy remember to take a few readings and average out the battery value



  • Hello @sundberg84, I would like to buy the Easy/Newbie PCB for MySensors but I have a few questions
    I want to use it the 5V Arduino Pro mini not the 3V version
    I also want to use the battery monitor
    Is it ok or should I modify "something"
    Also all the pcbs have the battery "expansion: or not?
    Thanks, Emmanuel


  • Mod

    Why would you want to use the 5v arduino on batteries?


  • Hardware Contributor

    @manos

    I want to use it the 5V Arduino Pro mini not the 3V version

    Then you need to use the nrf24l01+ version, that works fine - the RFM69 version needs a 3.3v Pro Mini only.

    I also want to use the battery monitor

    As @gohan said - don't use batteries on a 5v node. Use a 3.3v because it will use up your batteries very quickly. See the guides i have on openhardware for different modes on my PCB.

    Is it ok or should I modify "something"
    Also all the pcbs have the battery "expansion: or not?

    "something" is hard to understand, you can modify i many different ways depending on what you want to do. All the basic "modifications" can be found if you read the project page on openhardware.io



  • @sundberg84 thanks for your response
    If I don't care about battery consumption can I still view and use the battery monitor to be alarmed when battery is empty?


  • Hardware Contributor

    @manos yes you can.



  • This post is deleted!

 

382
Online

7.7k
Users

8.6k
Topics

92.3k
Posts