💬 Easy/Newbie PCB for MySensors



  • Thanks @sundberg84 and @gohan

    I have used made the board for 3.3v set up as per the instruction. I have usd the output from tp4056 into the Battery connector of the board I have a step board from https://www.aliexpress.com/item/New-Electric-Unit-1-PC-NEW-DC-0-8-3-3V-to-DC-3-3V-StepUP/32724361266.html According to the specification given in the same link it is supposed to stabilize to 3.3v above 3v but the sensor reports something else back to the gateway.

    0_1512985662819_a428954d-5f74-4026-8782-e12b51f52bf3-image.png


  • Hardware Contributor

    @hiddenuser - well, what would a battery measurer be if it reported a constant 3.3v boosted voltage? 😉
    It all depends on how everything is connected (pictures?) but if you have connected it as battery instryctions the radio and voltage divider that measured the incoming battery are not a part of the booster circuit. This to prevent noice to the radio and to be able to actually measure the battery voltage and not step-up voltage which is the idea behind the board.


  • Mod

    @hiddenuser I'm missing how can you use a booster to get 3.3v from a lipo battery



  • hey, has anyone maybe made a fritzing drawing/component of the board?
    I know, I'm lazy as f but.. since the board is that easy, documenting with it could be easy as well 🙂



  • @sundberg84 interesting question...or maybe stupid question not sure...

    i have a tonn of 3v pro mini's but im thinking of mains powering some for motion sensors.... would i set it up as battery, and then just use a voltage regulator on where the step up usually would be? or is there a better way to handle it?


  • Mod

    there is a voltage regulator footprint on the pcb made for that



  • ahhh thats cool... so use regulated instead and it will pull down the voltage for antenna over that side
    ...and the board can handle the voltage anyway so it should be fine....



  • @gohan The only voltage regulator that I know of on the board is mainly for the radio. Unless you are talking the one on the pro mini.

    @markjgabb If you want to do them from mains power, you might wan t to look at the HLK modules like these
    https://www.ebay.com/itm/1Pcs-Power-Supply-Step-Down-Buck-Isolated-Hlk-Pm03-220V-To-3-3V-Module-New-Ic-N/332047987473?epid=571729397&hash=item4d4f9a3311:g:nyMAAOSw4GVYPa8q
    Otherwise an old phone charger should work.


  • Mod

    @dbemowsk if I remember well the regulator Vout is also connected to the pro mini vcc



  • @gohan Have a bare board right in front of me. Ran continuity and no connection from regulator V-Out to VCC. VCC goes to the REG jumper and V-Out goes to the BAT jumper. VCC ties to the V-In on the regulator.



  • @gohan ayou wouldn't want to run the pro mini and the radio both off of that small regulator anyway. Takes too much from the radio.



  • @dbemowsk cheers for that...yeah i have a tonn of old 5v bricks lying around from old nokia chargers, so was just going to try use some of them up without having to buy anythiing else, as i have all of it on hand.... i have some LE33a's which should take care of any step down issues i think?



  • @markjgabb If you connect your 5V brick to the RAW pin, the onboard regulator on the pro mini will do.



  • @dbemowsk cheers mate, thats awesome...now i can blitz out some room based designs



  • @gohan @sundberg84
    This is my setup. my battery reading is a constant 2.75v, this is not true the multi meter says ~4v

    0_1513062564871_IMG_20171212_180306_1.jpg


  • Hardware Contributor

    @markjgabb @dbemowsk @gohan - I dont have much else to add, thanks for the input here. Using mains power I would also use HLK-PM01 and input the 5v to the pro mini. If you only have 3.3v pro mini you need to input this to RAW. I have made a breakout board for the HLK module if needed as well.

    https://www.openhardware.io/view/504/HLK-PM01-breakout-board


  • Hardware Contributor

    Well it looks like your battery goes to some sort of regulator before the Easy board? If so my guess is that that board is providing 2.7 v regardless of battery voltage? Have a look at @gohan and his posts about solar power and different batteries. EasyPCB is designed for 2xAA and it will not work with other voltages out of the box. The voltage divider is also dimensioned for 3.3v max and will not work with higher voltages. Again @gohan has made some experiments with this. Check his posts out. If you re-dimension the voltage divider it will work with your higher voltage.


  • Mod

    @hiddenuser I don't know why you have a booster in place (unless it is a buck boost) and you need to change the voltage divider resistors if you want to read higher voltages (look at my solar project). In addition I'd put in place a LDO regulator if you want to use a lipo battery since a normal voltage regulator would require a higher Vin than a lipo battery can provide.



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

    Thanks @gohan for the feedback. Can I have the link to your solar project!


  • Mod

    @hiddenuser look in the my project section (I'm on mobile now)



  • Hi Sundberg,

    I have read there could be some problem about radio connection if the temperature is ~0C or minus, I have met this issue so I will replace the existing 4.7µ capacitor with a bigger, e.g. ~20µ.
    The battery measurement contains a 0.1 uF capacitor, What do you think I do have to replace it with an another bigger one ?
    thanks

    Barna


  • Hardware Contributor

    @barna - i don't know to be honest. As I wrote I had issues last winter but never with that 0.1 cap. I'm running second winter now (have been as low as -8C so far) without issues.




  • Hardware Contributor

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

    Hi Sundberg,

    I have read there could be some problem about radio connection if the temperature is ~0C or minus, I have met this issue so I will replace the existing 4.7µ capacitor with a bigger, e.g. ~20µ.
    The battery measurement contains a 0.1 uF capacitor, What do you think I do have to replace it with an another bigger one ?
    thanks

    Barna

    I don't think you need, it's made to stabilize the measured voltage, in the worst case the measured voltage will be a little bit unstable but your node will still run fine.



  • on the subject of batteries i have to say im really impressed with the setup of these boards....
    ive got a DHT and lux resistor measuring every 10 minutes, and i cant even remember how long ago i last changed the batteries...i think its about 3-4 months now....nothing special, just aldi batteries (australian cheap shopping chain)

    last check they are still 65%



  • @markjgabb Don't know if it's the same chain, but we have aldi stores here in the US.
    0_1513550068757_11f86073-b6bf-40a7-be80-0b6115b268af-image.png



  • @dbemowsk It is. It's a german chain though 😉



  • @marvin78 Never knew that.



  • Hi everybody. Finally got my newb pcb and I soldered everything needed for the pro mini 3.3v. But I ran into problems.

    I think it's the cheap chinese pdo mini but I want to ask you guys. Problem id that my node doesn't work. But when I debug my node I plug my pro mini in my computer's usb and then it works.

    What I could see is that when it is battery operated I can read a 3.3v value on the vcc pin of the pro mini. When I also connect via usb this value is about 3.5v.

    Could it be that my pro mini requires 3.5v.
    I did solder the capacitor for the radio and i'm using a 3.3v step up converter also.

    Thank you



  • @akamap an you post a picture of your board setup?


  • Mod

    @akamap without knowing how you are powering the node, it is difficult to say.


  • Hardware Contributor

    @akamap - listen to the guys above, let us know with pictures 🙂 Its the best.
    Did you by any chance miss to solder to jumpers?
    The best approach is to measure with a multimeter... put the black to GND and measure your way through the circuit from batteries, booster, jumper, pro mini and radio with the red put on each components VCC (or Vout on booster). Then you know where it goes wrong. Try to follow the schematics or the traces in the pcb to figure out how the current flows.



  • @sundberg84 That's why I wanted him to send pictures. There are a number of variables that need to be in place depending on the configuration that you are using with this board. Is he using a 3.3 or 5 volt arduino, does he have a regulator, are the correct jumpers in place. Any one of these missing factors can make it not work.



  • EDIT : Seeing the pictures this big, I think I know why and it is my fault. I tried to save energy by desoldering the led on the arduino. I followed a post here on mysensors.org. But I just realized I might have desoldered the wrong thing on this arduino. I'm not sure what I desoldered, but it might be what is causing the problems (I desoldered the tiny thing below the led) I'll put a fresh one to see if this is working.

    Thanks

    Original response :

    Ok, thank for all the answers and here is more information.

    I power it via 2AA battery. I did put a jumper on the battery point. And I am using a pro mini 3.3v (Cheap chinese clone). I am using a step up regulator to step it up to 3.3v for the arduino.

    I measured the voltages and they are as follow :

    Without USB programmer (Not working) :
    Battery : 3.00V
    Input step up : 3.00V
    Output Step UP : 3.35V
    VCC and GND on arduino : 3.34V
    VCC and GND on Radio : 3.01V

    With the USB programmer pluggued in (Working) :
    Battery : 3.00V
    Input step up : 3.00V
    Output Step UP : 3.47V
    VCC and GND on arduino : 3.48V
    VCC and GND on Radio : 3.00V

    Another information, I did not solder directly the arduino pro mini (you will see on the pictures). I don't know what the are called but I'll call them "extender". I use them so I can unplug the arduino in case I fried the pro mini.

    Here are some pictures with and without the usb programmer plugged in :

    3_1515614804192_20180110_145714.jpg

    2_1515614804191_20180110_145654.jpg

    1_1515614804191_20180110_145643.jpg

    0_1515614804191_20180110_145634.jpg


  • Hardware Contributor

    @akamap thats just the resistor... should not be the problem.
    I cant see anything obvious. I have some radios without silkscreen and they work....... like a clone. Not the best but most work ok. Try adding a capacitor on the booster - might be a noisy one... I would recommend to try a 0,1uF ceramic if you have. Otherwise just wack in what you have... not to big i think.

    If you power it from the booster/bat you cant power it the same time from USB! Disconnect VCC from the ftdi adapter.
    Connet RX/TX and GND to begin with. RST if you need to upload. Two power sources makes one to much.


  • Mod

    @akamap remember also the cap on the battery measurement side if you want to get good readings. If you want to use batteries you need to remove the voltage regulator from the pro mini, once you done your troubleshooting



  • Thank you everyone. Everythings seems to be working now. I did solder a capacitor on the booster.

    But I don't think this was all that was bad. I also find out that when I touched the capacitor for the radio, I was having mixed result. So I soldered the capacitor directly on the radio.

    Now, everything works fine. I guess I burned the trace or something was creating a short with this part.

    I just need to remove the voltage regulator as suggested by gohan now and I can start testing my battery life.

    Thanks again. Great library, great forum but most of all, great community.


  • Hardware Contributor

    So its coming up for a new revision of the EasyPCB (both Nrf + RFM edition).
    I have had some suggestions from the community so far and some thoughs of myself:

    • ATSHA204A (signing)
    • Change 0,1uF and 10uF capacitor so now 10uF is on the input and 0,1uF on the output
    • Line up MysX connector for a more clean placement of daugherboards.

    Anyone have any other input before i start the work?
    I will not take any suggestions that will make the board heavy or non user-friendly. Still the same goal - only easy to use components, easy to assemble and easy to understand.


  • Mod

    How about a flash chip + 2 resistors for FOTA ? 😇


  • Hardware Contributor

    @gohan - interesting. What would be the easiest way to do this do you think? Placement?
    Can I avoid SMD components?


  • Mod

    the flash chip is 8 pins smd unless you choose a specific breakout board, resistors are your choice; they could fit unterneath the pro mini or on the back side

    Also you may need to work on the NRF5x version too 😄



  • Put the battery measurement components under the Arduino. This makes the board more generic and frees up space on the right side of the board that can be used for more sensors. Expand the prototype area so that more sensors can be installed on the board.
    And if one uses the board for battery only, the whole right section can be cut off but the battery measurement circuit is still there.



  • Now that I think of it, there is a small difference between the NRF and RFM board, the prototype area on the RFM board is not correctly spaced, the holes are a fraction to narrow spaced, one cant fit a header there without bending the pins


  • Mod

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

    Now that I think of it, there is a small difference between the NRF and RFM board, the prototype area on the RFM board is not correctly spaced, the holes are a fraction to narrow spaced, one cant fit a header there without bending the pins

    Yes, I noticed that too


  • Hardware Contributor

    @gohan @mickecarlsson
    Thanks for your input! I will probably redo the Nrf version in KiCad since the old in is in eagle so I will line everything up 🙂

    About the battery measurement components under the Arduino - I was thinking of putting the signing chip there.
    If you want to use the battery divider you need the booster as well so therefore its nessecary to have the board uncut. with this in mind I think it does not matter about the voltage divider placement or?

    Im not sure a 8 pin SMD component is right for EasyPCB - It seems a bit to advanced and unclear?
    Maybe I can do this with a MysX shield?



  • If I don’t use the booster and connect both BAT and REG and feed the board with two AA batteries i can use the battery components to measure the voltage of the battery. That is how I use it today.


  • Hardware Contributor

    @mickecarlsson - ahh, I see - good one!
    Let me think and maybe try some in KiCad and i let you know what I descide.


  • Mod

    The flash chip uses pins that are not on the connector.
    I understand that you want to keep it simple, but adding the signing chip and the flash chip to a project it is not very easy either


  • Hardware Contributor

    @gohan - you are right.
    Maybe I can use the back side for the smd parts? Again I will test and see how it works out in KiCad. I might do some testing and post to get feedback. Im really afraid I will lose the easy to use function which the pcb is designed for though and if I feel I do the smd parts will be excluded.

    Maybe I could do a rev 10 which includes more heavy stuff and keep rev 9 as well as the Easy version.


  • Mod

    I don't see it as a complicated thing, since if you don't need it then you just don't use it and you only have a few smd pads unused.


  • Hardware Contributor

    @gohan - valid point!
    What makes it complicated is if you are a new user who sees all these pads and dont understand if they have to be populated or used. But by adding those with clear labels on the bottom side might do the trick.


  • Mod

    @sundberg84 Exactly, maybe a label like "signing" and "FOTA" would make it more obvious to the user (of course it needs to be added to the project page too)


  • Hardware Contributor

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

    If I don’t use the booster and connect both BAT and REG and feed the board with two AA batteries i can use the battery components to measure the voltage of the battery. That is how I use it today.

    Why dont you use the internal library to measure the battery voltage? Im thinking about this and can't find a reason to move the voltage divider since without the booster you could just use the internalref and a library to measure the voltage?



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

    Why dont you use the internal library to measure the battery voltage? Im thinking about this and can't find a reason to move the voltage divider since without the booster you could just use the internalref and a library to measure the voltage?

    Good point, I have not thought of that. I will test it it. And will probably save some uA in the process. Thanks,



  • @sundberg84 I have now a node running with the BAT link removed, the REG link attached and I have used the Arduino_Vcc library.
    The battery report are consistent with the battery voltage measured with a digital volt meter.
    EDIT: Code below had a bug in it, I have fixed the bug and updated the code. The bug affected the temperature readings
    So, to run the RFM69 board on two AA batteries I have done the following:

    1. Removed regulator and led from Arduino
    2. Burned a new bootloader with a 1.7 volt BOD
    3. Put a link in REG position
    4. Solder radio to board
    5. Solder antenna to board.
    6. Solder BME280 to power and A5, A6
      And that's it.
      Here is my 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
     *
     * This is a sketch I use to measure temperature, battery level and signal level on
     * my Easy/Newbie PCB for MySensors (rev 9)
     * Hardware used:
     * Easy/Newbie PCB for MySensors
     * BME280 (I only use temperature and humidity, all code for barometic pressure removed)
     *
     */
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    #define   MY_SPLASH_SCREEN_DISABLED  // This saves a couple of bytes
    // Enable and select radio type attached
    #define   MY_RADIO_RFM69
    #define   MY_IS_RFM69HW
    #define   MY_RFM69_NEW_DRIVER
    #define   MY_RFM69_FREQUENCY RFM69_868MHZ
    // #define   MY_RFM69_ENABLE_ENCRYPTION
    
    #include <MySensors.h>
    #include <Wire.h>       // Enables the Wire communication protocol.
    // Bosch BME280 Embedded Adventures MOD-1022 weather multi-sensor Arduino code, 
    // written originally by Embedded Adventures. 
    // https://github.com/embeddedadventures/BME280
    #include <BME280_MOD-1022.h>
    // Internal battery measurement https://github.com/Yveaux/arduino_vcc
    #include <Vcc.h>
    
    #define SKETCH_NAME    "Test-4"
    #define SKETCH_VERSION "1.10"
    
    // Battery measurements
    const float VccMin        = 2.0*1.0;  // Min Vcc level, in Volts. Example for 2xAA Alkaline.
    const float VccMax        = 2.0*1.5;  // Max Vcc level, in Volts. Example for 2xAA Alkaline.
    const float VccCorrection = 3.02/3.12;  // Measured Vcc by multimeter divided by reported Vcc
    
    Vcc vcc(VccCorrection);
    
    // VARIABLES YOU CAN CHANGE
    // Send temperature only if it has changed? 1 = Yes 0 = No.
    #define COMPARE_TEMP 0
    // Set this value to the minimum change in temperature to measure.
    // BME280 has +-0.5 degrees precision, so it really doesn't matter that much.
    float tempThreshold = 0.5;
    // Send temperature only if changed? 1 = Yes 0 = No.
    #define COMPARE_HUM 0
    // Set this value to the minimum change in humidity to measure.
    // BME280 has +-3% relative humidity precision, so it really doesn't matter that much.
    float humThreshold = 0.5;
    
    #define TEMP_CHILD_ID       1
    #define HUM_CHILD_ID        2
    #define VOLTAGE_CHILD_ID    3
    
    float lastTemperature = -1;   // Store previous measurement
    float lastHumidity =    -1;   // Stores the previous measurement
    int sendBattery = 6;          // report battery level only after 6 loops = 6*4 mintes = 24 minutes
    int batteryLoop = 0;          // Placeholder for batteryloop
    
    unsigned long FOUR_MINUTE_SEND_FREQUENCY = 4 * 60000;  // Time between send (in milliseconds).
    
    // MYSENSORS COMMUNICATION VARIABLES
    MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP);
    MyMessage humidityMsg(HUM_CHILD_ID, V_HUM);
    MyMessage voltageMsg(VOLTAGE_CHILD_ID, V_VOLTAGE);
    
    void setup()
    {
    
    #ifdef MY_DEBUG
      Serial.begin(115200);
    #endif
    
      Wire.begin(); // For the BME280 sensor
    #ifdef MY_DEBUG
      Serial.println(F("Starting ..."));
    #endif
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      // Present the sensors to the gateway and controller
      present(TEMP_CHILD_ID, S_TEMP, "Temperature Test-4");
      present(HUM_CHILD_ID, S_HUM,   "Relative humidity Test-4");
      present(VOLTAGE_CHILD_ID, S_MULTIMETER, "Battery Test-4" );
    }
    
    void loop()
    {
    #ifdef MY_DEBUG
      Serial.println(F("Read BME280 and report it's values."));
    #endif
      GetTemperatureHumidity(); // Get temperature and humidity
    
      if(batteryLoop > sendBattery) { // Is the batteryLoop higher than sendBattery?
    #ifdef MY_DEBUG
        Serial.println(F("Read the battery voltage and report it."));
    #endif
        MeasureBattery();         // Measure and report battery level
        batteryLoop = 0;          // Reset batteryLoop count
    }
    #ifdef MY_DEBUG
      Serial.print(F("Go to sleep for: "));
      Serial.print(FOUR_MINUTE_SEND_FREQUENCY / 60000);
      Serial.println(F(" minutes."));
    #endif
      batteryLoop++;
      sleep(FOUR_MINUTE_SEND_FREQUENCY);        // Sleep for 4 minutes
    }
    
    void GetTemperatureHumidity()
    {
    #ifdef MY_DEBUG
      Serial.println("");
      Serial.println(F("BME280 - Requesting new data from sensor module."));
    #endif
      BME280.readCompensationParams();    // Need to read the NVM compensation parameters.
      // Normal mode for regular automatic samples
      BME280.writeStandbyTime(tsb_0p5ms);         // tsb = 0.5ms
      BME280.writeFilterCoefficient(fc_16);       // IIR Filter coefficient 16
      BME280.writeOversamplingPressure(os16x);    // pressure x16
      BME280.writeOversamplingTemperature(os8x);  // temperature x8
      BME280.writeOversamplingHumidity(os8x);     // humidity x8
      BME280.writeMode(smNormal);
        
    #ifdef MY_DEBUG
      Serial.println(F("Getting new values"));
    #endif
      while (BME280.isMeasuring()) {  // Wait for BME280 to fininsh reading data
    #ifdef MY_DEBUG
        Serial.println(F("Measuring..."));
    #endif
        delay(50);
      }
      Serial.println(F("Done!"));
      // Read out the data - must do this before calling the getxxxxx routines
      BME280.readMeasurements();
      float temperature = BME280.getTemperatureMostAccurate();  // Get the temperature first.
      float humidity = BME280.getHumidityMostAccurate();        // Get the humidity.
    #ifdef MY_DEBUG
      Serial.print(F("BME280 - Temperature = "));
      Serial.print(temperature);
      Serial.println(" °C");
      Serial.print(F("BME280 - Humidity = "));
      Serial.print(humidity);
      Serial.println(F(" %"));
    #endif
    
      // Now, let's send the measurements to the gateway.
      // Send temperature if the temperature difference bigger than the threshold
      if (COMPARE_TEMP == 1 && abs(temperature - lastTemperature) < tempThreshold) { 
    #ifdef MY_DEBUG
        Serial.print(temperature - lastTemperature);
        Serial.println(F(" Temperature difference too small, don't send it to gateway."));
    #endif
      } else {
    #ifdef MY_DEBUG
          Serial.println(F("Sending new temperature to the gateway."));
    #endif
          send(temperatureMsg.set(temperature, 1));
          lastTemperature = temperature; // Save temperatures for compare in the next round.
      } 
      // Send humidity if the humidity difference is bigger than the threshold.
      if (COMPARE_TEMP == 1 && abs(humidity - lastHumidity) < humThreshold) { 
    #ifdef MY_DEBUG
        Serial.print(humidity - lastHumidity);
        Serial.println(F(" Humidity difference too small, don't send it to the gateway."));
    #endif
      } else {
    #ifdef MY_DEBUG
        Serial.println(F("BME280 - Sending the new humidity to the gateway."));
    #endif
        send(humidityMsg.set(humidity, 1));
        lastHumidity = humidity; // Save new humidity to be able to compare in the next round.
      }
    #ifdef MY_DEBUG
      Serial.println(F("BME280 - Measurement complete. Putting sensor to sleep."));
    #endif
      BME280.writeMode(smSleep);  // set the BME280to sleep mode, save battery
    } // GetTemperatureHumidity
    
    /*
    *
    * MeasureBattery 
    *
    *
    */
    void MeasureBattery() //The battery calculations
    {
      float Vbat = vcc.Read_Volts();
      int batteryPercent = static_cast<int>(vcc.Read_Perc(VccMin, VccMax));
    
    #ifdef MY_DEBUG
      Serial.print(F("Battery percent: ")); 
      Serial.print(batteryPercent); 
      Serial.println(" %"); 
      Serial.print(F("Battery Voltage: ")); 
      Serial.print(Vbat); 
      Serial.println(F(" Volts"));
    #endif
        sendBatteryLevel(batteryPercent);
        send(voltageMsg.set(Vbat,2)); //send battery in Volt 2 decimal places
    }
    
    
    

  • Hardware Contributor

    @mickecarlsson - nice work! Let us know how it turns out 🙂
    Any pictures of this you can share?

    I did see you put VccMin to 1,2V and this might calculate so the battery will be @ 30% when the BOD hits you. I would put this to 2.0v if you are using a internal 8mhz bootloader. https://forum.mysensors.org/topic/7296/how-to-burn-fuses-so-that-pro-mini-3-3v-would-go-down-to-1-8v-solved/15



  • @sundberg84 Hi, I soldered a board holding a humidity and temperature sensor. That is working fine and reporting to may gateway (mqtt). Only thing which I do not get working ok is the battery level measurement. As I already posted in an other topic here.

    Here are some pictures of my board. The bat jumper is connected with a wire on the bottom. And the code I use on it right now.
    I already changed the pro mini for a fresh soldered one but still getting the the same result. Just ones giving the volt and % and after that only giving 0 volt as output.
    tried to include delay(500) in the sketch but that did not help. So how to solve this?

    
     
    #define MY_NODE_ID 2
    #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 <SparkFunHTU21D.h>
    #include <MySensors.h>  
    #include <Wire.h>
    #include <SPI.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 CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_BATTERY 2
    //#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("Humidity", "2.0");      
       
     // 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;
    
    
       
    }
    
    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)                                                                                             
    static int oldBatteryPcnt = 0;                                                                                                                                                                        
                                                                                                                                                                   
                                                                                                                                                                            
    //Create an instance of the object                                                                                                                                          
    HTU21D myHumidity;                                                                                                                                                         
    
                                                                                                                                                                                                                                                                                                                                 
    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_PRCNT);
    
    
    void setup() {
        myHumidity.begin();
    
         // use the 1.1 V internal reference
    #if defined(__AVR_ATmega2560__)
        analogReference(INTERNAL1V1);
    #else
        analogReference(INTERNAL);
    #endif
    
    
    } 
                                                                                                                                                                                                                                                                                                                                                     
    void loop()                                                                                                                                                                 
    {                                                                                                                                                                           
      float temperature = myHumidity.readTemperature();                                                                                                                         
      //if (!metric) {                                                                                                                                                            
      //    temperature = (temperature * 1.8) + 32.0;                                                                                                                             
      //}                                                                                                                                                                         
      send(msgTemp.set(temperature, 1));
      Serial.print("T: ");
      Serial.println(temperature);                                                                                                                                     
    
      float humidity = myHumidity.readHumidity();                                                                                                                               
      send(msgHum.set(humidity, 1));                                                                                                                                         
      Serial.print("H: ");
      Serial.println(humidity);
    
    
       // 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  
                                                                                                                                           
    }
    

    0_1518613859739_IMG_5970.jpg 0_1518613878092_IMG_5971.jpg 0_1518613893620_IMG_5972.jpg 1_1518613931939_IMG_5907.jpg 0_1518613931939_IMG_5906.jpg 0_1518613977125_IMG_5908.jpg


  • Mod

    I don't think it is PCB related, try to make sure it is not a faulty arduino



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

    I don't think it is PCB related, try to make sure it is not a faulty arduino

    I already changed the arduino for a fresh soldered one but that did not alter things.


  • Hardware Contributor

    @mr_sensor - I can not see any errors on the pictures you posted.
    Can you measure the voltage on Booster-Vout and also on this pad.

    0_1518627818269_d0a0507b-dcfd-45c0-a8a7-288e718afc3d-image.png



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

    @mr_sensor - I can not see any errors on the pictures you posted.
    Can you measure the voltage on Booster-Vout and also on this pad.

    0_1518627818269_d0a0507b-dcfd-45c0-a8a7-288e718afc3d-image.png

    I did measure the parts you mentioned. Booster is 3,36 v and the other pad is 0,00 the input strait from the batteries is 2,80 v

    Also, Just for my info, does it matter how the resistors or capacitors are soldered on the board? My biggest problem is always determine the right resistors value and the right way to solder them (+ -). On the pcb some of them are coded (very handy for me as a beginner) with a G but not all of them?
    So my worry was that I maybe have soldered the "battery measurer" ones in the wring direction? Could that be the problem here?


  • Mod

    Resistors can be soldered either way, but if you read 0v on that capacitor pin it mean you have a problem between the battery and the capacitor, so you have to backtrack the connection that is missing



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

    Resistors can be soldered either way, but if you read 0v on that capacitor pin it mean you have a problem between the battery and the capacitor, so you have to backtrack the connection that is missing

    I measured the capacitor again and get a 0,10 output.


  • Mod

    What are the resistor values you used? 0.1v is quite low



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

    What are the resistor values you used? 0.1v is quite low

    Maybe I used the wrong capacitor it says 1uf (50v) but now I see it has to be 0,1uf could that be the problem here?


  • Hardware Contributor

    Capacitor value does not change the voltage. The resistors does... I would double check that you use the right resistors. For example it's easy to use a resistor marked 1k instead of 1M. With 3.3v you should have around 1v on the capacitor.


  • Mod

    you are also missing the capacitor on the booster output for better stability



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

    you are also missing the capacitor on the booster output for better stability

    Ok, I assumed it was not needed when using a battery. Which one to use there?


  • Mod

    It is needed if you use a booster. Look at project page for details.


  • Hardware Contributor

    @mr_sensor a advice is to measure the resistance again over the resistors.



  • @sundberg84 Well I tried that but did not get the measurement straight from the pcb si I decided t solder a new board using the right capacitor this time (0,1uf instead of 1uf) made sure using the right resistors as well and adding a capacitor after the booster. Than with the same mini pro from the other board tested again and wow it is working as intended.

    Child ID 2Battery Voltage: 3.44 V
    Battery Percent: 102 %
    2930 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:102
    2938 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2945 TSF:TDI:TSL
    2947 MCO:SLP:WUP=-1
    2949 TSF:TRI:TSB
    3065 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    3178 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    957
    Child ID 2Battery Voltage: 3.22 V
    Battery Percent: 95 %
    3690 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:95
    3698 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    3704 TSF:TDI:TSL
    3706 MCO:SLP:WUP=-1
    3708 TSF:TRI:TSB
    3815 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    3932 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    955
    Child ID 2Battery Voltage: 3.21 V
    Battery Percent: 95 %
    4442 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    4452 TSF:TDI:TSL
    4454 MCO:SLP:WUP=-1
    4456 TSF:TRI:TSB
    4560 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    4673 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    953
    Child ID 2Battery Voltage: 3.21 V
    Battery Percent: 95 %
    5185 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    5193 TSF:TDI:TSL
    5195 MCO:SLP:WUP=-1
    5197 TSF:TRI:TSB
    5304 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    5416 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    952
    Child ID 2Battery Voltage: 3.20 V
    Battery Percent: 95 %
    5926 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    5935 TSF:TDI:TSL
    5939 MCO:SLP:WUP=-1
    5941 TSF:TRI:TSB
    6045 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    6158 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    952
    Child ID 2Battery Voltage: 3.20 V
    Battery Percent: 95 %
    6670 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    6678 TSF:TDI:TSL
    6680 MCO:SLP:WUP=-1
    6682 TSF:TRI:TSB
    6789 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    6901 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    952
    Child ID 2Battery Voltage: 3.20 V
    Battery Percent: 95 %
    7411 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    7419 TSF:TDI:TSL
    7424 MCO:SLP:WUP=-1
    7426 TSF:TRI:TSB
    7530 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    7643 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    952
    Child ID 2Battery Voltage: 3.20 V
    Battery Percent: 95 %
    8155 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8163 TSF:TDI:TSL
    8165 MCO:SLP:WUP=-1
    8167 TSF:TRI:TSB
    8273 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    8388 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    955
    Child ID 2Battery Voltage: 3.21 V
    Battery Percent: 95 %
    8898 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8908 TSF:TDI:TSL
    8910 MCO:SLP:WUP=-1
    8912 TSF:TRI:TSB
    9021 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    9132 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    948
    Child ID 2Battery Voltage: 3.19 V
    Battery Percent: 94 %
    9646 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:94
    9654 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    9660 TSF:TDI:TSL
    9662 MCO:SLP:WUP=-1
    9664 TSF:TRI:TSB
    9771 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    9881 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    952
    Child ID 2Battery Voltage: 3.20 V
    Battery Percent: 95 %
    10395 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:95
    10403 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    10409 TSF:TDI:TSL
    10412 MCO:SLP:WUP=-1
    10414 TSF:TRI:TSB
    10520 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    T: 998.00
    10635 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:998.0
    H: 998.00
    953
    Child ID 2Battery Voltage: 3.21 V
    Battery Percent: 95 %
    11147 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    11155 TSF:TDI:TSL
    

    Now in mqtt I can see the percentage as:

    95
    qos : 0, retain : false, cmd : publish, dup : false, topic : **mygateway1-out/2/255/3/0/0**, messageId : , length : 30, Raw payload : 5753```
    
    But not the voltage?

  • Hardware Contributor

    @mr_sensor good to hear its working.
    It looks like you are only sending the % and not the voltage?



  • @Mr_sensor It happened to me once that capacitor was just shortening the circuit, it was a smd, but when I removed it and tested it it was constantly making shortage, thus the circuit was never working and luckily my power supply had a low enough protection.
    I examined cap very closely, all looked fine, but internally it was not working fine.

    Since most of us (well, me at least) are buying cheap components I made it a habit now to always measure every passive component before installation, partly eliminates one variable


  • Hardware Contributor

    A short sneak-peak on the upcoming revision...
    Still a long way to go...

    0_1519205922527_266ef138-f029-43ed-925e-d3992fce5ed2-image.png

    Rev 10 - Nrf24l01+ ed.

    • Completley redesigned in KiCad.
    • MysX location changed to accept more MysX boards and align like RFM version.
    • Optional signing added
    • Optional SPI flash added.
    • Extra pins aligned to 2.45 vertical & horisontal
    • Relocated Extra + Bat Measurer some to allow more space to booster
    • Changed pull-up resistor from D3 to D5 to have one more pin for Interrupt
    • Relocated D5 pullup, MysX and IRQ jumper some.
    • Changed footprint (silk-screen) on capacitor to easier show Gnd/Pos side.

    Need to change footprint on voltage regulator on both nrf and rfm edition back to a square and not a liniar one. (rev 9 change). Not intended to revert back.

    Also a bit worried the 4,7uF cap os to far away from radio.


  • Mod

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

    Also a bit worried the 4,7uF cap os to far away from radio.

    Putting it underneath the nrf24 module? I know it is not a "clean solution" but there would be still be unused space under the radio module


  • Hardware Contributor

    @gohan - thanks, not what I want to do - I have descided to have optional/more advanced on bottom side. This is the core idea of the PCB. I might revert back to Rev 9 footprint and squeeze it in like prev. revision.


  • Mod

    maybe a smaller footprint for ceramic instead of electrolitic?


  • Hardware Contributor

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

    • MysX location changed to accept more MysX boards and align like RFM version.

    Please don't do like that and follow the guideline for the MYSX connector (location was already wrong in previous versions and it's a bit annoying to make MYSX boards for Easy PCB):
    *"The MYSX connector should be placed close to the board edge with a 100 mil spacing from all edges. The footprint has a courtyard outline to emphasize this"

    Also a bit worried the 4,7uF cap os to far away from radio.

    I agree especially with other traces to cross before reaching the radio.


  • Hardware Contributor

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

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

    • MysX location changed to accept more MysX boards and align like RFM version.

    Please don't do like that and follow the guideline for the MYSX connector (location was already wrong in previous versions and it's a bit annoying to make MYSX boards for Easy PCB):
    *"The MYSX connector should be placed close to the board edge with a 100 mil spacing from all edges. The footprint has a courtyard outline to emphasize this"

    I actually had a long discussion with @Anticimex which is the designer of MysX and he said it is not wrong. Can you please explain why it's wrong ?

    I was thinking pin 1 should go towards both vertical and horizontal edge of the pcb (that's why I asked him because I though It should go where the radio is) but he said the only rule is pin 1 should go towards the edge. I looked at the rules and that is what it said so I don't think I'm breaking any rules.

    The MYSX connector should be placed close to the board edge with a 100 mil spacing from all edges. 
    The footprint has a courtyard outline to emphasize this. 
    It should be oriented so that pin1 is always closest to the board edge parallel to the connector. 
    This allows a daughter board designed using the same constraints to be facing back "inwards" over the motherboard
    

    Either way it has changed like less than 1mm

    If we can somehow get Anticimex to recommend and we can agree on a better placement I'm happy to re-think my design.

    If you thinks it's hard to create MysX boards for EasyPcb I have created a finished Kicad project with board outlines, connector and drill holes you can use as a template. Check it out on the project page.


  • Contest Winner

    @sundberg84 I cannot see anything wrong with the MYSX placement on that board.
    If one could pick freely, ideal placement of the connector would be in the middle of the board side to allow daughter boards to extend both "upward" and "downward".
    But the important rule is the one already cited, that pin1 is oriented to ensure daughterboard orientation relative to the motherboard and that there is spacing around the connector so that the daughterboard female connector does not come in contact with main board cirquitry.
    Also that the daughterboard does not protrude outside of the mainboard at least along the edge the connector is aligned to.
    Daughterboards in general should not be designed to be wider than the MYSX connector used for this reason (avoiding daughterboard protruding outside mainboard area) to allow a mainboard specific case to be reused with daughterboards mounted.

    Edit: if possible, try to move the components right next to the connector. (remember the 100mil spacing). The resistor below can probably be mounted on the reverse side.


  • Hardware Contributor

    Back to the drawing desk! 🙂

    Edit: MysX alignment changed so PCB needs to be redesigned.


  • Hardware Contributor

    I have moved the discussion about the alignment here :
    https://forum.mysensors.org/topic/9060/mysx-connector-alignment


  • Hardware Contributor

    0_1519327367931_ce480687-293d-48dd-ba6b-84914d58efdd-image.png

    Thoughs? (Noth Nrf + RFM)
    @Nca78 - MysX alignment?


  • Contest Winner

    @sundberg84 be careful about daughterboards colliding with the pro mini.


  • Hardware Contributor

    @anticimex - thanks for input. Same with radio I guess... ? Don't know how to solve it by fitting all these things into one board.


  • Contest Winner

    @sundberg84 The rfm69 radio can be surface mounted. If one goes for headers, the pitch it uses allow for low profile headers so the radio should go clear under a daughterboard assuming it does not have reverse side mounted components with a high profile.


  • Hardware Contributor

    @anticimex you could use male headers on mother and female headers on daughter...

    0_1519328398026_IMG_20180222_203454.jpg

    Or just mount the mother on top.

    here it seems the capacitor is the biggest concern.


  • Contest Winner

    @sundberg84 if I remember correctly, the motherboard has to use male MYSX. So there is no option for that. I thought you planned to use sockets for the arduino. But if it is soldered directly on the pcb, it should go clear I think. But best to use angled ftdi interface then.


  • Hardware Contributor

    Yes I guess the only viable solution with MYSX and a pro mini is to solder the promini without headers so it can be under the daughter board and big (electrolytic capacitor) or sensible (radio antenna) stuff can be as far away as possible.

    @sundberg84, I'm not sure it's great to have antenna in that position for my "vertical" concept but I guess it's not a great idea any more to do that. Now that pin 1 is in a corner I have all the space in the world to put reed/hall switch next to the other side (on top of pro mini) and it will be much more in line with expected use of MYSX connector.
    Antenna is on the side that's not supposed to be below daughter board so I don't think you can do better for that., I think it's much better than before, I'll be able to make a board that's more versatile than the current one with footprints for most common sensors.


  • Hardware Contributor

    @sundberg84
    not sure but on your preview, I see that you don't use any gnd planes?? Imho, just sayin for your users :), it would be better to have it, ideally unbroken+ vias, for impedance, emi, rf counterpoise, impedance matching rf feedline to sma depending on its length and how it's routed etc.., maybe a little google it 😉

    looks nice 👍


  • Hardware Contributor

    @scalz - yes it is true about ground plane! I did that one rev 4 or something but something broke the thing... so I have been hesitating since but I know all about the benefits - been reading and googling.

    I have not made any traces or planes on the images - just component placement. I will give it another shot... maybe I have learned some since rev 4 😉

    Thanks for your feedback.


  • Contest Winner

    @sundberg84 I forgot to mention that your nRF24 module goes very close to the MYSX. There is a risk a female receptacle might collide with the rf module if you are unlucky. And daughterboards will most likely be at least as wide as the courtyard of the MYSX.


  • Hardware Contributor

    @sundberg84
    yes not talking about your latest but saw that on your rev9 and 10 pics.
    it will make it better, and it's good point for rf quality (range and msg fail) 😉
    placing planes is one of the first thing I usually do after component placements.. then it's easier to route as it solves many connection.

    keep the good work!



  • @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!





Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts