My Slim 2AA Battery Node


  • Hardware Contributor

    Motion sensor example
    As already mentioned; more details to be found here.http://forum.mysensors.org/topic/2715/slim-node-as-a-mini-2aa-battery-pir-motion-sensor

    20160102_001318.jpg



  • do u add these photos and comments to openhardware.io ? they are quite helpful


  • Hero Member

    @m26872 I don't use any I2C pull-ups. All my Si7021/ SHT21 (GY-21) boards include the SDA/SCL pull-ups (and LDO voltage regulator/ level conversion).


  • Hardware Contributor

    @AWI
    Oops, it makes me worried that I completely forgot that this project was in some test stage. Ldo and everything should probably be bypassed, but I wanted to test it first. Post edited. Thanks for noticing!

    And sorry for everyone else if this caused any trouble.

    (It also makes me a little worried about that I have too many ongoing projects right now. ๐Ÿ˜– )



  • @AWI said:

    @m26872 I don't use any I2C pull-ups. All my Si7021/ SHT21 (GY-21) boards include the SDA/SCL pull-ups (and LDO voltage regulator/ level conversion).

    @m26872 said:

    @AWI
    Oops, it makes me worried that I completely forgot that this project was in some test stage. Ldo and everything should probably be bypassed, but I wanted to test it first. Post edited. Thanks for noticing!

    And sorry for everyone else if this caused any trouble.

    (It also makes me a little worried about that I have too many ongoing projects right now. ๐Ÿ˜– )

    Apologies again, so that I understand it, does that mean when adding the mentioned temp sensor nodes I need additional parts?


  • Hardware Contributor

    @rsachoc My mistake and my apology. Unfortunatly I can't even finish and share the resluts from that humidity sensor in a while since I'm leaving for a few weeks holiday.

    Anyway
    @riataman Shows a mod of the GY-21 board in this post. He also link to a board without the LDO and level converter. In any case you wont need the two 4k7 pull-up in my pictures above, only if use the bare chip.



  • What about using a hall effect sensor to detect magnet ?

    I have a door sensor using the same contact sensor, but I also have a hall effect sensor and I hope to test it soon. It is very small compared to the contact sensor.



  • Hello m26872,
    your project is great, and i will order tomorrow a set of PCBs.
    I've done a breadboard setup with the SI7021 according to your schematic and your sketch, which works flawlessly.
    (ATmega328P / SI7021 / NRF24L01 / 2xAA Battery / your 1Mhz bootloader / your Fuse Settings)

    Unfortunately I do not get the current consumption below 2mA.
    What to do to get the power consumption below 10uA and to increase the battery life on a couple of years ?
    Any help is appreciated...


  • Hero Member

    @sensorchecker A power consumption of 2mA is way out of range. Is your sensor entering sleep? Or an ftdi adapter still connected?



  • can i run it on 5V without any problem.

    For the RF433 interface i need 5V so i would like to make one that is powerd by an usb charger.



  • @AWI

    No FTDI Adapter, no LED and nothing else is connected.
    I build the node like the schematic in the first post.
    When i start the sensor node, power consumption is about 16mA.
    After a few seconds (4-5sec) the current goes down to 2mA

    Can you please tell me, how to find out, that the node is in sleep mode
    I have really no idea how to fix that.. but i have to, because i ordered the PCBs today!

    Thanks for your help


  • Hardware Contributor

    @sensorchecker I think you should start with a simple example like the "reed switch sensor" and by looking at the other sketches you should be able to add some debug prints yourself. You only need a high ohm resitor 1M-10M and two pieces of wire to simulate a button or switch.


  • Hardware Contributor

    @arnoldg The nRf24L01+ is rated like 1.9-3.7V. So 5V will probably kill it.



  • Oke, that's tru i didn't think of that.
    but when i use a 5v - 3v power suply in between it could work.



  • @m26872
    I have already tested the "reed switch sensor" and it works fine for me- but with a power consumption of 2mA ...:-(
    Is it possible that i have a problem with the bootloader or the fuses ?
    How can i check that ?
    Usually i use USBASP and avrdude for programming the processors on breadboards.
    Is it also possible to do the whole programming with the arduino IDE ?



  • @sensorchecker did you try changing your nrf ?


  • Contest Winner

    @sensorchecker and @m26872 changing the NRF module did work for me as well.

    I was struggling a lot getting the power consumption down using all the trick and tips as described on the mysensors forum but nothing worked for by battery powered nodes (i have a couple these ).

    I was not able to bring the power consumption down below 2.4 mA (with the NFR mounted) finally i just, for an differnt experiment, i took a "fresh"NRF and just for the fun i measured the current and it was down to 0.05 mA for no reason. They came from the same batch.

    My theory now is that i broke the first radio module during programming of the node, although the FTDI serial module is in 3.3v mode it still measures around 4.5 volt. So the voltage might has damaged my NRF radio a bit (it still communicates).



  • @ahmedadelhosni and @BartE and @m26872 you made my day...!
    Changing the NRF module was the solution, now my power consumption is about 8uA.
    Now waiting for the PCBs and parts to build 10- 15 nodes

    Thank you so much for your help



  • There is no crystal?

    I haven't used Atmega328P as standalone but I have read that you need a crystal.


  • Hardware Contributor

    @flopp There's an internal 8MHz xtal in the uC. Infact often default set to be used by factory "fuse" settings. It's not as ambient condition stable and accurate as an external crystal, but quite good enough for our application.



  • @m26872 thanks



  • What about these pF caps, why not use SMD tantalum instead of Solid electrolyte with legs?

    Or can I use ATmega without caps, since I dont have an external crystal?


  • Hardware Contributor

    @flopp I doubt there are any electrolytes in the pF range seen here. If you mean the pF caps in the example pictures, they are not part of the Slim Node base concept and just a random choice I did for myself. If you mean all the 100nF caps in the base concept, it's a matter of the "smd free" design criteria I apply from time to time.


  • Hardware Contributor

    @flopp ... or if you refer to the standard pair of 22pF caps used when there is an external crystal - no, you wont need them.



  • @m26872 said:

    @flopp I doubt there are any electrolytes in the pF range seen here. If you mean the pF caps in the example pictures, they are not part of the Slim Node base concept and just a random choice I did for myself. If you mean all the 100nF caps in the base concept, it's a matter of the "smd free" design criteria I apply from time to time.

    OK. Yes, I saw that there was cap in pictures.



  • @m26872 said:

    @flopp ... or if you refer to the standard pair of 22pF caps used when there is an external crystal - no, you wont need them.

    OK, perfect



  • Hi together,

    as first i have to say, its a nice node, that you build.
    So i tried to build one. I ordered an atmega 328p. Flashed the bootloader from the forum. This is the boards.txt:

    atmega328_1mhz_4800baud.name=ATmega328 on a breadboard 1MHz internal clock, fast start, 1.8V BOD, 4800baud upload
    
    atmega328_1mhz_4800baud.upload.protocol=arduino
    atmega328_1mhz_4800baud.upload.maximum_size=32256
    atmega328_1mhz_4800baud.upload.speed=4800
    
    atmega328_1mhz_4800baud.bootloader.low_fuses=0x42
    atmega328_1mhz_4800baud.bootloader.high_fuses=0xDE
    atmega328_1mhz_4800baud.bootloader.extended_fuses=0x06
    
    atmega328_1mhz_4800baud.bootloader.file=atmega/atmega328_1b.hex
    atmega328_1mhz_4800baud.bootloader.unlock_bits=0x3F
    atmega328_1mhz_4800baud.bootloader.lock_bits=0x2F
    
    atmega328_1mhz_4800baud.build.mcu=atmega328p
    atmega328_1mhz_4800baud.build.f_cpu=1000000L
    atmega328_1mhz_4800baud.build.core=arduino:arduino
    atmega328_1mhz_4800baud.build.variant=arduino:standard
    
    
    atmega328_1mhz_4800baud.bootloader.tool=arduino:avrdude
    atmega328_1mhz_4800baud.upload.tool=arduino:avrdude
    

    Now i have measured the current draw, and the arduino alone draws 6.8mA (without crystal, nrf ...)
    I tried some sketches, (binaryswitchsleepsensor) but the current is not really gone down.
    The only sketch is this:

    // **** INCLUDES *****
    #include "LowPower.h"
    
    void setup()
    {
        // No setup is required for this library
    }
    
    void loop() 
    {
        // Enter power down state for 8 s with ADC and BOD module disabled
        LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);  
        
        // Do something here
        // Example: Read sensor, data logging, data transmission.
    }
    

    With this sketch is the current 0.02mA

    OK, 0.02mA is not bad, but when i read that some of you have few ยตa, i dont understand why the current on my atmega is so "high"

    Can somebody tell me what bootloader is good, wich fuses are good. And maybe what i have to do to get the current so small as possble

    Thank you very much
    Greets Eddie


  • Hardware Contributor

    @meddie I don't really get what you've ruled out in your troubleshooting. Do you "test the arduino alone" using MySensors lib and example sketches? Using Lowpower lib directly works ok as it seems. Next step would be to connect the nRF24L01+ and run some MySensors lib example.

    Ext fuses 0x07 (BOD disabled) instead of 0x06 (BOD 1.8V) could save you a few uA.



  • @m26872 said:

    Do you "test the arduino alone" using MySensors lib and example sketches?

    Yes, on the bredboard is only the atmega 328p. nothing else. Connected to 5v

    Using Lowpower lib directly works ok as it seems.

    Yes using the LowPower lib i came down to 0.01mA current draw.

    Next step would be to connect the nRF24L01+ and run some MySensors lib example.

    Ok, i will try it today evening.

    Ext fuses 0x07 (BOD disabled) instead of 0x06 (BOD 1.8V) could save you a few uA.
    OK, i try this too.

    Thank you very much.
    Greets Eddie



  • ok, i tried to burn with 0x07 Fuse. And i tried to power the atmega with 3.3 v and not 5v.
    Now i came down to 4ยตA in sleep mode with the lowpower sketch.
    When i try to flash a mysensors sketch the the atmega has a current draw 1mA.


  • Hardware Contributor

    @meddie It's still unclear whether you've got the nRF connected and the MySensors example and library fully working (sleeping) before you measure.



  • @meddie If you have a extra nRF try using that, i had a similar issue and i tried replacing the nRF and it came from mA to uA.



  • yes of course, i just connected a nrf to the atmega an uploaded the binaryswitchsleepsensor sketch. Now i have a current draw 95.6ยตA
    But when i take the door contact off the atmega draws only 1.3ยตA
    When the door contact is closed (from 3 to GND) the the current is rising to 95.6ยตA


  • Hardware Contributor

    Makes sense to me. By closing the contact you get a path from 3V3 via the pullup resistor to ground.

    The current is (for a pullup resistor value around 30KOhm) around 100uA.

    Try NOT using the internal pullup resistor of pin D3, and using an external pullup resistor of 1MOhm or more.

    You will see lower current when the contact is closed.



  • ok, i dont have 1mohm here. but i just ordered them. When i get them i will try out and will write here.
    Thynk you very much for your help.
    Great Forum! Great Projekt!
    Greets Eddie



  • Hello,
    This board is GREAT. But why C5 ave to be different from C1 C2 C3 ?


  • Hardware Contributor

    @Pierre-P I haven't verified the benefits of C5, so it's just theoretical. You could probably omit or replace without any significant difference.

    Anyway, the reasons behind are seen in the BOM. 1 - Package (under uC socket). 2 - RF performance (single layer).



  • @m26872 I see it in the BOM. But now, i can't see where it goes (5 hours... I ask a question, and 5 hours later I can't see what i was talking about....)

    C4 is cool for the NRF pic of tension, but -just for information- it could be wherever between 0Vcc and 5Vcc, not necessarily near the NRF ?

    As an electrician, and not an electronician, I don't understand why so many 0.1uF capacitor are needed (but i put them too) as we can see in MySlimNode2-sch.pdf that they are virtually at the same place... ๐Ÿ˜…

    Thanks for the answer !



  • @m26872 I am about to order the v2 version of the board and I have a few questions as I have never ordered PCBs before.
    The defaults on ordering are:
    layers - 2
    thickness - 1.2 mm
    coating - HASL
    stencil - none

    What are these options? I am tempted to just order as-is...for $14 what could I complain about? I am just curious what these other options are for.


  • Hardware Contributor

    @wergeld
    Layers - The board is designed with 2 copper layers (top and bottom) so you can't change that.
    Thickness - Of your taste. Default is well proven but e.g. a little thinner could make it easier when you break the panelizing cuts.
    Coating and stecil - Honestly I've never bothered to look them up. But google is your friend if you put PCB before as keywords.



  • Hello @m26872 it is me again if you do remember me.

    Just wanted to tell you that I ordered the boards 5 weeks ago and it was delivered to Egypt after 2 weeks, and the silly customs requested some security approvals to give me the boards which I couldn't do it till now. Something pathetic which makes me laugh ๐Ÿ™‚

    Can't wait to do my nodes !


  • Hardware Contributor

    @ahmedadelhosni Welcome back! Yes I remember you had to struggle and could not buy common 433MHz remote controlled switches. Makes sense to do diy projects then I guess.
    Hope you get your new nodes running. Please share your result.



  • @m26872 You are right.

    I'll go tomorrow and try to get the approval ๐Ÿ™‚ Well back soon



  • Finally !
    0_1453641891107_1453641880064-1500367089.jpg

    11 pcbs. But I am really angry and feel bad from what happened by DHL.
    I paid 29$ for shipping and here in Egypt i paid stupid fees for customs and several things equal to 38$ !!!!! I dont know wether this is something related to my country Egypt or not ๐Ÿ˜ž

    I' ll try to forget all what I paid when I do my first node.



  • @ahmedadelhosni that really sucks ๐Ÿ˜ž



  • Hello all,

    I have been struggling with this for a couple of weeks now and I just can seem to figure out a good way to upload sketches to the arduio328p-pu. First of all I use this setup;

    I use arduino for mac 1.6.5
    I use a breadboard with a crystal, two capacitors and a resistor between reset and 5v.
    An arduino to burn bootloader (with the chip inserted and sketch arduinoISP uploaded).
    I use the same hex files as you guys with 1a. I used the optiboot 9600 BOD, just the 9600 and the 4800. Uploading the bootloader is no problem at all. Arduino ide burns the bootloader without any problems. However when I try to upload the sketches I get different errors. The โ€œYikesโ€ version in which it states that my device signature is not ok and programmer not responding. I use upload using programmer.

    So, I tried to upload the arduino uno version to rule out all miscabling. So what I did was upload the arduino uno bootloader, tried to upload the blink sketch afterwards and it works. So my cables are okโ€ฆ.

    I thought to repeat the exact same process with the boot version above. However no succes, I keep getting stuck at uploading sketches. Is it just not possible?

    I read about setting the fuse options and I read that when you define these in the boards.txt, they will be set as the fuseparameters. When I check the boards txt above i see that fuse settings are: L0x62,H0xde,E0x07, however when I open the png file (first post, fuse settings) it states L0x62,H0xDE,E0xFF. Furthermore the lockbits are at 0xCF, compared to the boards.txt 0x2F. What is true and how should I set these. I donโ€™t see a possibility in arduino ide (I use another arduino to upload, so I donโ€™t have a tiny or USBASP.

    Help would be much appreciated here because I have like 30 boards sitting catching dust.


  • Hardware Contributor

    @ahmedadelhosni : no luck! Here same for us in France. I think it's because they handle our package from airport to house...but have we not already paid for this! There is vat of course too, but here vat+15euro extra mystical handle fee.
    Fun, is when you want to make a joke to the dhl person and you ask why fees, I don't want pay, give me my package, no come back!! ahaha they are not funny ๐Ÿ™‚ At less, if they were doing right their job, 4times/10 they say "you were not here"??? yep, but I was there..and where is the paper in my mailbox, nothing...arrgh! what do you think I will wait you on the road???

    No matter, looking at your package, I think you will have lot of fun ๐Ÿ™‚



  • @scalz Seeing that someone else had the same issue made me better hahaha ๐Ÿ™‚
    The problem that I went myself to take it today and they told me that I have to buy for the customs and the government.

    I need to calm down and have fun better. Thanks ๐Ÿ™‚


  • Hardware Contributor

    @betonishard A few "unused" bits of the Ext fuses are differently written in avrdude (Arduino IDE) and Atmel IDE programmer implemetation. That's why the same settings can look different. You have to know which one you use.
    Search for "Avr fuse calculator" on the internet and some will show you fuses for both methods.

    I also had issues with avrdude when I started and never got it to work. A lot of others do of course, but I found the Atmel way easier for me. Hence only this is shown in the pictures. The bootloading business is not easy and a lot of info is availible on the arduino forums. I think the only way is to read and study.



  • @betonishard said:

    Hello all,

    I have been struggling with this for a couple of weeks now and I just can seem to figure out a good way to upload sketches to the arduio328p-pu. First of all I use this setup;

    I use arduino for mac 1.6.5
    I use a breadboard with a crystal, two capacitors and a resistor between reset and 5v.
    An arduino to burn bootloader (with the chip inserted and sketch arduinoISP uploaded).
    I use the same hex files as you guys with 1a. I used the optiboot 9600 BOD, just the 9600 and the 4800. Uploading the bootloader is no problem at all. Arduino ide burns the bootloader without any problems. However when I try to upload the sketches I get different errors. The โ€œYikesโ€ version in which it states that my device signature is not ok and programmer not responding. I use upload using programmer.

    So, I tried to upload the arduino uno version to rule out all miscabling. So what I did was upload the arduino uno bootloader, tried to upload the blink sketch afterwards and it works. So my cables are okโ€ฆ.

    I thought to repeat the exact same process with the boot version above. However no succes, I keep getting stuck at uploading sketches. Is it just not possible?

    I read about setting the fuse options and I read that when you define these in the boards.txt, they will be set as the fuseparameters. When I check the boards txt above i see that fuse settings are: L0x62,H0xde,E0x07, however when I open the png file (first post, fuse settings) it states L0x62,H0xDE,E0xFF. Furthermore the lockbits are at 0xCF, compared to the boards.txt 0x2F. What is true and how should I set these. I donโ€™t see a possibility in arduino ide (I use another arduino to upload, so I donโ€™t have a tiny or USBASP.

    Help would be much appreciated here because I have like 30 boards sitting catching dust.

    Hi, i had the same problem, but then i tried the 1b hex and since i burned this it works for me.



  • @GertSanders said:

    Makes sense to me. By closing the contact you get a path from 3V3 via the pullup resistor to ground.

    The current is (for a pullup resistor value around 30KOhm) arounda lot of 100uA.

    Try NOT using the internal pullup resistor of pin D3, and using an external pullup resistor of 1MOhm or more.

    You will see lower current when the contact is closed.

    Yesterday i get a lot of resistors, now i testen 1Mohm and the current draw is around 4 ยตa, but now the arduino do not recognize when the reedcontact is closed or open. When the contact is closed the current draw is 4 ยตa when opened 1.2ยตa
    do i have to edit the sketch in order to get it to work?


  • Hardware Contributor

    @meddie
    The pull up 1MOhm resistor should go from Vcc - resistor - D2
    The switch should be connected to D2 and Gnd
    D2 needs to be defined as INPUT, no need to add the statement with PULLUP.
    Post your sketch so we can have a look.



  • /**
     * 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
     *
     * Interrupt driven binary switch example with dual interrupts
     * Author: Patrick 'Anticimex' Fallberg
     * Connect one button or door/window reed switch between 
     * digitial I/O pin 3 (BUTTON_PIN below) and GND and the other
     * one in similar fashion on digital I/O pin 2.
     * This example is designed to fit Arduino Nano/Pro Mini
     * 
     */
    
    
    #include <MySensor.h>
    #include <SPI.h>
    
    #define SKETCH_NAME "Binary Sensor"
    #define SKETCH_MAJOR_VER "1"
    #define SKETCH_MINOR_VER "0"
    
    #define PRIMARY_CHILD_ID 3
    #define SECONDARY_CHILD_ID 4
    
    #define PRIMARY_BUTTON_PIN 2   // Arduino Digital I/O pin for button/reed switch
    #define SECONDARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch
    
    #if (PRIMARY_BUTTON_PIN < 2 || PRIMARY_BUTTON_PIN > 3)
    #error PRIMARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
    #endif
    #if (SECONDARY_BUTTON_PIN < 2 || SECONDARY_BUTTON_PIN > 3)
    #error SECONDARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
    #endif
    #if (PRIMARY_BUTTON_PIN == SECONDARY_BUTTON_PIN)
    #error PRIMARY_BUTTON_PIN and BUTTON_PIN2 cannot be the same
    #endif
    #if (PRIMARY_CHILD_ID == SECONDARY_CHILD_ID)
    #error PRIMARY_CHILD_ID and SECONDARY_CHILD_ID cannot be the same
    #endif
     
    MySensor sensor_node;
    
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
    MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      sensor_node.begin();
    
      // Setup the buttons
      pinMode(PRIMARY_BUTTON_PIN, INPUT);
      pinMode(SECONDARY_BUTTON_PIN, INPUT);
    
      // Activate internal pull-ups
      digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
      digitalWrite(SECONDARY_BUTTON_PIN, HIGH);
      
      // Send the sketch version information to the gateway and Controller
      sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
    
      // Register binary input sensor to sensor_node (they will be created as child devices)
      // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
      // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
      sensor_node.present(PRIMARY_CHILD_ID, S_DOOR);  
      sensor_node.present(SECONDARY_CHILD_ID, S_DOOR);  
    }
    
    // Loop will iterate on changes on the BUTTON_PINs
    void loop() 
    {
      uint8_t value;
      static uint8_t sentValue=2;
      static uint8_t sentValue2=2;
    
      // Short delay to allow buttons to properly settle
      sensor_node.sleep(5);
      
      value = digitalRead(PRIMARY_BUTTON_PIN);
      
      if (value != sentValue) {
         // Value has changed from last transmission, send the updated value
         sensor_node.send(msg.set(value==HIGH ? 1 : 0));
         sentValue = value;
      }
    
      value = digitalRead(SECONDARY_BUTTON_PIN);
      
      if (value != sentValue2) {
         // Value has changed from last transmission, send the updated value
         sensor_node.send(msg2.set(value==HIGH ? 1 : 0));
         sentValue2 = value;
      }
    
      // Sleep until something happens with the sensor
      sensor_node.sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0);
    } ```

  • Hardware Contributor

    @meddie said:

    // Activate internal pull-ups
    digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
    digitalWrite(SECONDARY_BUTTON_PIN, HIGH);

    If you use the external pull up, you need to comment out these two lines like so:

    // Activate internal pull-ups
    // digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
    // digitalWrite(SECONDARY_BUTTON_PIN, HIGH);

    No need for an internal pullup if you use an external pull up.
    In the above I'm assuming you have an external pullup resistor for each digital pin, one for D2 and one for D3.



  • @m26872 said:

    @ahmedadelhosni You know that the nRF pins are not centered? That means if you rotate it like this it will no longer be straight above the "slim node motherboard".
    What height do you expect it to be?

    I understood now what you meant by "not centered". Thanks for notifying me.
    I'll take care of that.



  • @meddie are you also using the optiboot 9600 NOBOD in boards.txt the same as in the first post (fuse settings I mean)? And are you using avrdude arduino ide for mac?

    I tried your solution but i get the same results.. Yikes!

    If you use the same setup, can you post your boards.txt? Did you also make changes to the hex file?

    Thanks in advance.



  • @m26872 Thanks for your answer... The problem is I read a lot about it (which makes me kinda stupid that I still haven't achieved this).

    I tried to find atmel studio (I believe you are referring to atmel studio?) I couldn't find a proper mac version. I checked on the fuse calculator and still no success. Maybe some one could give me the correct fuse settings for AVR or a proper mac download link for atmel studio.

    OI know I am asking a lot, but it would help me a lot. Thanks.!!


  • Hardware Contributor

    @betonishard Yes, of course ask if you have problem. But I suggest you also make a new separate thread in General-, Hw- or Troubleshooting section about your issues.
    Maybe it's a good idea to ask in arduino forum as well.



  • Hello @m26872

    I succeeded now to burn the bootloader which you used (1Mhz). I just don't understand a phrase which you mentioned above.

    According to this you should use minimal startup time to reduce power in every 8s sleep cycle, but for the moment I don't care and stick to the default 65ms.

    Can you explain what is this ? and whether it is affecting badly on something or not ?

    Thanks..



  • its the fuse, which defines the rising time. the oscillator needs some time to come to the correct frequency. If you dont wait this time its possble that your sketch dont work correctly. But the microcontroller is the 65 ms longer not in sleep mode and need more battery power. but works more stable.



  • YEAH, YEAH YEAH! Thank you all for the help a big thanks to GertSanders. Now it seems to work perfectly. The current draw is now 4.6ยตa. Now i have to transfer from bredboard to pcb.
    Thank you very much!!!!!!



  • Here

    @betonishard said:

    @meddie are you also using the optiboot 9600 NOBOD in boards.txt the same as in the first post (fuse settings I mean)? And are you using avrdude arduino ide for mac?

    Hi no i use the ide for Windows i dont have a mac.

    Here is the hex File

    :107E0000112484B714BE81FFE6D085E08093810001
    :107E100082E08093C00088E18093C10086E0809377
    :107E2000C20089E18093C4008EE0BFD0259A86E02D
    :107E300023EC3FEF91E0309385002093840096BBC4
    :107E4000B09BFECF1D9AA8958150A9F7EE24FF2480
    :107E5000AA24A394B5E0CB2EA1E1BA2EF3E0DF2E45
    :107E600098D0813461F495D0082FA5D0023829F13B
    :107E7000013811F485E001C083E083D07FC08234F3
    :107E800011F484E103C0853419F485E09CD076C0F8
    :107E9000853579F47ED0E82EFF247BD0082F10E0C2
    :107EA000102F00270E291F29000F111F84D07801E1
    :107EB00065C0863521F484E086D080E0DECF84364C
    :107EC00009F040C066D065D0082F63D080E0E81686
    :107ED00080E7F80618F4F701D7BEE895C0E0D1E0D6
    :107EE00058D089930C17E1F7F0E0EF16F0E7FF06A2
    :107EF00018F0F701D7BEE8955ED007B600FCFDCFBD
    :107F0000A701A0E0B1E02C9130E011968C9111977F
    :107F100090E0982F8827822B932B1296FA010C0160
    :107F2000A7BEE89511244E5F5F4FF1E0A038BF0770
    :107F300051F7F701C7BEE89507B600FCFDCFB7BE05
    :107F4000E8951CC0843761F424D023D0082F21D0B9
    :107F500032D0F70185917F0114D00150D1F70EC0C6
    :107F6000853739F428D08EE10CD085E90AD08FE02E
    :107F700084CF813511F488E018D01DD080E101D084
    :107F80006FCF982F8091C00085FFFCCF9093C600E3
    :107F900008958091C00087FFFCCF8091C00084FDD0
    :107FA00001C0A8958091C6000895E0E6F0E098E150
    :107FB000908380830895EDDF803219F088E0F5DF4B
    :107FC000FFCF84E1DECF1F93182FE3DF1150E9F7D5
    :107FD000F2DF1F910895282E80E0E7DFEE27FF27CC
    :027FE000099402
    :027FFE0000057C
    :0400000300007E007B
    :00000001FF
    

    Just create a new txt file put this code in there and rename the file to atmega328_1b.hex

    this is my boards.txt:

    ##############################################################
    
    atmega328_1mhz_4800baud.name=ATmega328 on a breadboard 1MHz internal clock, fast start, 1.8V BOD, 4800baud upload
    
    atmega328_1mhz_4800baud.upload.protocol=arduino
    atmega328_1mhz_4800baud.upload.maximum_size=32256
    atmega328_1mhz_4800baud.upload.speed=4800
    
    atmega328_1mhz_4800baud.bootloader.low_fuses=0x42
    atmega328_1mhz_4800baud.bootloader.high_fuses=0xDE
    atmega328_1mhz_4800baud.bootloader.extended_fuses=0x07
    
    atmega328_1mhz_4800baud.bootloader.file=atmega/atmega328_1b.hex
    atmega328_1mhz_4800baud.bootloader.unlock_bits=0x3F
    atmega328_1mhz_4800baud.bootloader.lock_bits=0x2F
    
    atmega328_1mhz_4800baud.build.mcu=atmega328p
    atmega328_1mhz_4800baud.build.f_cpu=1000000L
    atmega328_1mhz_4800baud.build.core=arduino:arduino
    atmega328_1mhz_4800baud.build.variant=arduino:standard
    
    
    atmega328_1mhz_4800baud.bootloader.tool=arduino:avrdude
    atmega328_1mhz_4800baud.upload.tool=arduino:avrdude
    

    this worked for me!


  • Hardware Contributor

    @ahmedadelhosni I've never verified it by measuring, but I understood like @meddie about Gammons writing.
    To get rid of those 65ms startup time you should use fuses 42-DE-FF (Lo-Hi-Ext) instead of 62-DE-FF.

    If anyone could verify and measure current between sleep cycles and share some results, it would be great.



  • @meddie and @all Tonight I think I have fixed my issue however how I do not understand so maybe someone can explain, or maybe I think I have fixed it and it is not fixed at all.

    On the arudino website it states that when you burn your bootloader you have to connect pin 13,12,11 and pin 10 to reset (and ofcourse 5v and ground). AFter burning the bootloader you should replace it with the rx and tx cable and disconnect 13,12,11 and connect reset to reset. Each time I did this I got the error of Yikes! However tonight by accident I forgot to rewire the pins to rx and tx and press โ€œUpload using programmerโ€ all of a sudden it stated โ€œdone uploadingโ€.

    I tested this with blink sketch so I attached a led to pin13 and ground. The led started to blink. I was happy however did not understandโ€ฆ. or is this just a n00b mistake



  • @meddie said:

    @betonishard said:

    Hello all,

    I have been struggling with this for a couple of weeks now and I just can seem to figure out a good way to upload sketches to the arduio328p-pu. First of all I use this setup;

    I use arduino for mac 1.6.5
    I use a breadboard with a crystal, two capacitors and a resistor between reset and 5v.
    An arduino to burn bootloader (with the chip inserted and sketch arduinoISP uploaded).
    I use the same hex files as you guys with 1a. I used the optiboot 9600 BOD, just the 9600 and the 4800. Uploading the bootloader is no problem at all. Arduino ide burns the bootloader without any problems. However when I try to upload the sketches I get different errors. The โ€œYikesโ€ version in which it states that my device signature is not ok and programmer not responding. I use upload using programmer.

    So, I tried to upload the arduino uno version to rule out all miscabling. So what I did was upload the arduino uno bootloader, tried to upload the blink sketch afterwards and it works. So my cables are okโ€ฆ.

    I thought to repeat the exact same process with the boot version above. However no succes, I keep getting stuck at uploading sketches. Is it just not possible?

    I read about setting the fuse options and I read that when you define these in the boards.txt, they will be set as the fuseparameters. When I check the boards txt above i see that fuse settings are: L0x62,H0xde,E0x07, however when I open the png file (first post, fuse settings) it states L0x62,H0xDE,E0xFF. Furthermore the lockbits are at 0xCF, compared to the boards.txt 0x2F. What is true and how should I set these. I donโ€™t see a possibility in arduino ide (I use another arduino to upload, so I donโ€™t have a tiny or USBASP.

    Help would be much appreciated here because I have like 30 boards sitting catching dust.

    Hi, i had the same problem, but then i tried the 1b hex and since i burned this it works for me.

    @meddie @betonishard I guess I know the solution. Yesterday I begun creating my nodes with the same setup and faced the same issue. When You upload your sketch, choose your board, and the important thing which will solve the "Yikes" error, is to choose "Arduino as ISP" not "ArduioISP". You will find it under Tools > Programmer.

    Another thing. If you are chip is the one which comes with the arduino UNO, then you have to add a crystal at the first time when you change the bootloader. According to what I read yesterday (and this solved an issue also which I faced) that the chip is already configured to use external crytsal. Thus (for the first time only), I tried adding a 20 Mhz, and 10Mhz as I didn't have 16Mhz, and surprisingly both configurations worked ๐Ÿ™‚

    let me know please if that helps.



  • @meddie THanks for the answer.

    Can you please also explain your final result to reach 4uA. I have also the same problem and current is 90uA and sometimes drops to 20uA, then rises again. Thanks.

    Edit: I figured out that I was using the 3.3v from arduino UNO. CHanged to two 1.5 batteries. THe current drops to 1.4uA when contact is open but sometimes it is also 15 uA. And when contact is closed it is 60 uA, and sometimes drops. Don't know why it is not stable.

    Edit 26.1.2016: I managed to reach 1.4uA with door opened, and 15uA when closed. I guess the problem was with the wiring. DOn't really know but I used a battery holder instead. I will try to rechange the resistor value to 1Mohm and reupdate.

    Edit 27.1.2016: ok I created another node and connected the contact sensor in series with the 1Mohm and the output is the voltage divider. now it is 1.4uA when open and 4.6uA when closed.

    Thanks



  • @m26872 said:

    Board releases:

    Well, can I ask an update ? It's about the labels, couldn't we have them on the two faces ? It's always good to know where are Vcc and Gnd at first eye I think.
    After all, the atmega and nrf are the only components that can't move to the other side. But even there, knowing the digital and analog pin should be useful !



  • My PCBs have just arrived and I was going to build a couple of sensors but canยดt figure out the first part of how to burn the bootloaders.

    For starters can I just use one of the PCBs and solder the atmega socket and a 6 pin header near the nrlf-radio headers? And use this with a Atmega-programmer ?or do I need to solder any more components?

    I tried with both a usbasp and a USBtinyISP but could not get any new device to show up in the arduino IDE. But I donยดt know if it is a software issue with win10 or if it is hardware related.



  • I've made it with that link: http://www.gammon.com.au/breadboard with no cristal.


  • Hardware Contributor

    @Cliff-Karlsson Apart from the 2x3pin AVRISP you also need to supply power (battery?) Maybe easiest by the 1x6pin FTDI Vcc and Gnd pins. No other components should be needed.


  • Hardware Contributor

    @Pierre-P said:

    @m26872 said:

    Board releases:

    Well, can I ask an update ? It's about the labels, couldn't we have them on the two faces ? It's always good to know where are Vcc and Gnd at first eye I think.
    After all, the atmega and nrf are the only components that can't move to the other side. But even there, knowing the digital and analog pin should be useful !

    I think I'll collect "improvements" in a list. I agree that some labels could be added, but I don't think it's enough for a new board release.
    Also the boardhouse credit collection (which becomes MySensors donations) will be scattered and smaller if there's many versions and branches.



  • @m26872 said:

    AVRISP

    Ok so the AVRISP does not provide any power even as it is self powered from usb?


  • Hardware Contributor

    @Cliff-Karlsson At least that's how my programmer works (Avrisp MkII). I think it's a thing to not interfere when it's programmed "in circuit".



  • @m26872. Thanks for the design, very nice.

    On your posted picture of the GY-21, why have you added extra resistors? The Gy-21 has it's own pull ups 4.7k for the i2c bus, so additional resistors are not required!

    I removed the voltage regulator from the gy-21 board as well (detailed elsewhere in the forum) to save a little extra power. The only caveat to this is you've got to remember to remove the radio and gy-21 when programming using the usbtinyisp or usbasp as they run at 5v which could damage them.

    I'm using the (hallard) breakout board for the rfm69cw which has a much better range than the nrf24's (no idea why people use these unless they live in a rabbit hutch)

    Anyway, thanks once again for sharing.

    Glen.


  • Hardware Contributor

    @betgear If you had read the posts further down (just like the first line says), you would have seen that the discussion and explainations are already there. But thanks for sharing you results.


  • Hardware Contributor

    @betgear My guess is that the main reason for people to use nRF24 is because the MySensors support for RFm69 came rather recently.

    Edit: For me it's the price. I buy 20(!!!) pcs nRF24 for the price of one RFm69. Main reason is different shipping costs.



  • I just need to ask one more time so that I am absolutley clear abot the bootloader burning. I still cant figure out how to do this with my USBtiny.

    First of all my USBtiny provides 3.3 or 5v does it matter what voltage that I provide?
    And If I just place the ISCP (?) header and atmega socket I do not need to solder any more components or provide any more power to make the circut complete?


  • Hardware Contributor

    @Cliff-Karlsson said:

    First of all my USBtiny provides 3.3 or 5v does it matter what voltage that I provide?

    No, as long as it's only the Atmega there.

    And If I just place the ISCP (?) header and atmega socket I do not need to solder any more components or provide any more power to make the circut complete?

    Yes, correct. (ICSP)


  • Hardware Contributor

    @Cliff-Karlsson Forgot to add that there is already a bootloader on that requires external crystal, you have to add it before to get it work.



  • Ok thanks for the info. So if I do not have any crystals it is not possible to burn the bootloader in any way?


  • Hardware Contributor

    @m26872 said:

    @Cliff-Karlsson Forgot to add that IF there is already a bootloader on that requires external crystal, you have to add it before to get it work.

    (the important word "if" dropped out. )


  • Hardware Contributor

    @Cliff-Karlsson said:

    Ok thanks for the info. So if I do not have any crystals it is not possible to burn the bootloader in any way?

    No, not if its fuses are set for external crystal.


  • Hardware Contributor

    An ATMEGA328 coming from ATMEL is normally set to use the internal oscillator and has no bootloader. You will then have no need to put a crystal.

    I do this anyway on my breadboard (for the 28 pin DIP versions).

    If you have the SMD version of the atmega328 (the AU variant), I'm assuming it is set in the same default state (no crystal needed, running on internal oscillator).



  • @Cliff-Karlsson i added 10 Mhz and it worked as I didnt have 16 Mhz. Also tested with 20Mhz and worked



  • First node. Door sensor.
    Great boards :+
    0_1453937636107_1453937611984-964477924.jpg

    0_1453938444465_1453938399889-988876899.jpg

    .



  • @ahmedadelhosni said:

    @meddie THanks for the answer.

    Can you please also explain your final result to reach 4uA. I have also the same problem and current is 90uA and sometimes drops to 20uA, then rises again. Thanks.

    Edit: I figured out that I was using the 3.3v from arduino UNO. CHanged to two 1.5 batteries. THe current drops to 1.4uA when contact is open but sometimes it is also 15 uA. And when contact is closed it is 60 uA, and sometimes drops. Don't know why it is not stable.

    Edit 26.1.2016: I managed to reach 1.4uA with door opened, and 15uA when closed. I guess the problem was with the wiring. DOn't really know but I used a battery holder instead. I will try to rechange the resistor value to 1Mohm and reupdate.

    Edit 27.1.2016: ok I created another node and connected the contact sensor in series with the 1Mohm and the output is the voltage divider. now it is 1.4uA when open and 4.6uA when closed.

    Thanks

    Yes, i used a 1 Mohm reisitor instead of the internall pull up. You can read this few messages above. This was a tip from GertSander



  • Hi, I build the board but I still have issues with burning ATMega328p chip.
    Can you describe and attach files that should work?
    The only success "burn" I had with burning bootloader was with hex and boards entry from first post using arduino uno and ips programer ( so it is like burning uno bootloader with your setup)
    After that I was trying to upload sketch but than it was not possible because of "?# in boards file but there is no such sign.
    I rewert file to stock and burn sketch like it would be standard uno board but using programer and not standard usb. No idea if it is corect so that is why I ask for more details.
    Thank you in advance
    Tomasz


  • Hardware Contributor

    @Tomasz-Pazio Sounds more like some issue with the IDE and boards file than hw and fuses/bootloader. Have you tried different IDE versions?



  • @ahmedadelhosni
    what is it on the door? is that a plastic wrap?



  • @meddie
    0_1454272780491_1453938474660-1453938399889-988876899.jpg

    The sensor is drawn by black rectangle. This is adhesive tape like this : http://2.imimg.com/data2/YX/UQ/MY-3910304/sale-bopp-clarity-adhesive-tape-250x250.jpg

    The other red rectangle on the door was old tape I didn't remove. Actually before getting my boards I used a bread board and a battery for testing, so I needed a tape for support and keeping it in place ๐Ÿ™‚



  • ๐Ÿ‘



  • @m26872 thanks for advice, bootloader burned on IDE 1.0.x and after that, sketches are uploaded properly on 1.6.x.

    One more question, how it should report battery state? I can not see any variable created for this in Vera.


  • Hardware Contributor

    @Tomasz-Pazio Great! If I remember Vera correct, a variable should be created automaticly upon first message if you use the sendbatterylevel() fuction.



  • anyone care to write down the exact precedure of how to burn a new bootloader to the atmel chip? what files goes to what folders and so on.


  • Hardware Contributor

    @Cliff-Karlsson I'm experimenting with several versions of Optiboot (various upload and upload combinations) for my board. Once that is done, I will add it to the documentation of my board. I'm extending the sketch found here:

    http://www.gammon.com.au/forum/?id=11635


  • Hardware Contributor



  • OK, so finally I have received most of the parts I need to build a few of these sensors. I want to go with a temp sensor at first, the si7021. So I wanted to check what "other bits" I need (newb alert).

    0_1454624296448_upload-80039080-fce7-4484-b238-a54bdb2d28fd

    From there, do I need both 1 and 2? If so, what are these?

    0_1454624355650_upload-36748b2e-623b-4953-bdb4-394fbe264ef6

    From here, what are 3 and 4? Do I need both?

    Also, depending on the answers above, do I solder to exactly the same pins? Have I missed anything?

    Thanks



  • Ok, finaly succeded in burning the bootloader. Now comes next part. Fuses and lockbits, I have no idea what this means but is this what I need to do?

    avrdude -C ../etc/avrdude.conf -c usbasp -B5 -p ATmega328P -U lfuse:w:0x62:m -U hfuse:w:0xDE:m -U efuse:w:0x07:m -U lock:w:0x2F:m
    


  • oh, yes! And you have to be carefully with them, because to set the fuses wrong, can destroy your ยตcontroller



  • if you look to message Nr 179 you will find my bootloader and the correct fuses for this. But its a 1MHz Bootloader and the fuses too.
    Dont use it if you want to run it at 8 MHz.


Log in to reply
 

Suggested Topics

21
Online

11.4k
Users

11.1k
Topics

112.7k
Posts