My Slim 2AA Battery Node


  • Hardware Contributor

    @ahmedadelhosni
    I uploaded the brd in the v1.4 post above just for completness.
    Happy Kicading! Hope you'll enjoy. I liked it a lot better. There were a few nice youtube tutorials.
    You're welcome.


  • Hardware Contributor

    First Slim Node board donation from the DirtyPCB board share now sent. $12 to MySensors.org. Thanks to everyone that have ordered.

    Later credit draw will be in probably linger a bit. DirtyPCB seems to be somewhat of a non-profit community with manual attendance to all share credits. I almost got banned in my attempts to get a reply from them. In order to show my appreciation for their great service, I plan to only request further credits in quantities of 50. If the board not's been shared in a year a so, of course I'll make an exception.


  • Admin

    @m26872
    Thanks for the kind donation to the MySensors project. We'll use it to develop new fun things for the community!


  • Hero Member

    I was out of radio's, only a few "smd" types left which I mounted on the board with some patchwork šŸ˜‰

    upload-9bcfc8fe-4f7f-48ba-90dc-31443ed62f89

    Now even more space left in the (small) housing.

    upload-6b158358-0c6f-4983-89d4-16a13f9a87e9

    upload-b3b5aa3b-3e76-4690-a05c-49df931a6df7



  • Could u show a screen for the lockbits too? I have never set them before and need some guidance šŸ˜„ thanks

    Dakky


  • Hardware Contributor

    @dakky Done.



  • Is this what you used to burn the bootloader?

    USB-programmer-AVRISP-mkII-mk2-clone-ATMEL-AVR-New


  • Hardware Contributor

    I use this. Maybe not so expensive when I bought it 15 months ago, but still. I remember I was mad after I'd failed a lot with avrdude and cheaper tools (uno).



  • Just received my boards from DirtyPCB šŸ˜„
    Enough for 10x3=30 sensors... šŸ˜± The boards look nice. I think I can even skip the R&C's if I use the internal VCC measuring method but I'll have to scan the thread for that.


  • Hardware Contributor

    @martkrui R1 and C2 are mandatory if you intend to use the 6 pin FTDI port (I think you do). C3 (ARef - Gnd) is primarily for when you use Adc external ref, but (if I remember correct) it stabilizes the Adc in general. C1 (Vcc - Gnd) is just the "near chip supply input capacitor" and could probably be left out if there are some other caps near the nRF.



  • @dakky said:

    Could u show a screen for the lockbits too? I have never set them before and need some guidance šŸ˜„ thanks

    Dakky

    I use ubuntu, and a tiny USB, so after I have flashed my arduino board, I run this avrdude command, that will run until battery is low

    avrdude -c usbtiny -p m328p -U efuse:w:0x07:m
    

    I have bought usbtiny from this guy:
    http://www.ebay.com/itm/USBtinyISP-V4-AVR-ISP-Programmer-Reliable-Plastic-Enclosure-/330824700564?hash=item4d06b05294



  • @m26872 Hi again. Just a small update regarding rotating the nrf.

    I decided that in my designs I'll need the straight and rotated version, thus I'll design a small board to map the pin outputs like the image below. It will be above the ICSP pins but I really don't care about re flashing.

    I'll order the board as soon as I finish pcb layout of some other boards and ship all at once.

    Thanks.

    upload-dbcd859c-7c4c-4e46-959c-e83314602bcd


  • Hardware Contributor

    @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?



  • Another "noobish" question:
    When using this bootloader, one cycle takes 8 seconds? What happens, if for example, a switch is pressed between? does this sensor detect this?


  • Hardware Contributor

    @dakky Plz correct me... but I guess you're talking about the Avr sleep cycles? I don't know what that's got to do with the bootloader or this thread. I think it's related to interrupt, timers, mysensors and arduino lowpower library. The sleep cycles shouldn't be something to worry about if you're using the "sleep" function as in MySensors API.



  • @m26872 hmm you're right. maybe this is a too generic question to be discussed here. pardon me.



  • I had a bit of an issue getting things going as I've never played with the fuses before. Maybe this can save someone else some time. If I'm doing something silly here please correct me. šŸ˜…

    [DISCLAIMER] this worked for me. Use at own risk[DISCLAIMER]

    Executed these commands from the subfolder \hardware\tools\avr\bin of my local arduino IDE.
    Connected the board ICSP using an USBASP with the latest firmware. Change the "-c usbasp" part if you connect using something else.

    Flash bootloader

    avrdude -C ../etc/avrdude.conf -c usbasp -B5 -p ATmega328P -U flash:w:..\..\..\arduino\avr\bootloaders\atmega\atmega328_1a.hex
    

    Set fuses

    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
    
    

    I think the B5 was crucial as it slows things down a bit. The bootloader (atmega328_1a.hex) is the one mentioned in the first post. I also added the part in the boards.txt of the arduino IDE.

    Now I can connect the board to the FTDI and upload and run sketches without issues.

    On to the next step šŸ˜ƒ šŸ‘



  • I am not so really skilled in transferring a wiring diagram to "real live". Is this the correct implementation for battery measuring?

    upload-8e188148-e6c0-44ef-9b8c-a01fe9cd1c3a


  • Hardware Contributor

    @dakky First, the "normal" battery monitoring to this node is to use the internal method by, if you like, using the vcc library. Measuring Vcc with external voltage divider makes not a lot of sense. The external voltage divider is useful when measuring e.g. raw battery voltage to some voltage regulator.
    Second, I think you've switched A0 and Gnd in your drawing.



  • hurm did i switch them?
    Concerning the method: hmm ok. I just thought, that the one recommenced in the build section of mysensors should be the "correct" one.

    EDIT: Hrhr @Yveaux vcc lib is cute šŸ˜„ workd out of the box šŸ˜‰ thx



  • Is there some one who have lying around several boards, who can share them with me.
    i'm from the netherlands, and for now i only need 5 to 6 boards, not 30 šŸ™‚

    so i hope i could take over a couple from someone.


  • Hero Member

    @arnoldg send me a pm...



  • @arnoldg said:

    Is there some one who have lying around several boards, who can share them with me.
    i'm from the netherlands, and for now i only need 5 to 6 boards, not 30 šŸ™‚

    so i hope i could take over a couple from someone.

    Same here, anybody in US has 4 or 5 boards that i could buy?



  • Anyone want to share some photos with sensors assembled?
    Any experiences how long this node will last? I have one DHT11 and one BH1750 onboard and will wake up the node every 5-15 Minutes.

    Greetings
    Dakky



  • If I order the 10 pieces for 14$ how many sensor I can build? They mean 10 panels with 3 boards each one?



  • yes, thatĀ“s 30 sensors you could build then


  • Hardware Contributor

    @nikos1671 If you buy the proto pack you could get 9,10 or 11 boards. It could be different that exactly 10 boards. In my case I received 12 boards for my design, in another order I received 11 boards. My last order was 10 boards. But in any case you will be able to make more then 25 sensors. Plenty for a normal house.



  • @dakky said:

    Anyone want to share some photos with sensors assembled?
    Any experiences how long this node will last? I have one DHT11 and one BH1750 onboard and will wake up the node every 5-15 Minutes.

    Greetings
    Dakky

    I would like this too please! I'm trying to decide on which node to use as a motion sensor and temp/humidity sensor and would like to understand how I add a temp/humidty sensor to these and also the battery drain. And also, what temp/humidity sensors are we able to use with this node? I guess it ouputs max 3v, so does that mean the DHT11 and DHT22 are not able to be used here? Sorry for the newbie questions, I'm beginning to explore my options in relation to building my initial temp/humidity sensor and then a motion sensor.

    edit OK, so based on what m26872 said here (http://forum.mysensors.org/topic/2715/slim-node-as-a-mini-2aa-battery-pir-motion-sensor/5) I think that I can only use Si7021 or HTU21 sensors as this outputs around 3v? From reading the spec sheet of the DHT11 and 22 I see they need 3.7v, so I guess if I want to use those sensors I need this node (http://forum.mysensors.org/topic/486/my-2aa-battery-sensor)?


  • Hardware Contributor

    @rsachoc Yep, you got it right.



  • Arghls no DHT11 with this node? Dammit. But a step up converter should do it?


  • Hardware Contributor

    Humidity Sensor example
    http://forum.mysensors.org/topic/3049/slim-node-si7021-sensor-example

    (This post used to contain a not yet finished design by mistake. The link above now shows the correct finished project.)


  • Hardware Contributor

    Reed Switch example
    With external 10M pull-up to save battery. The plastic foam is used instead of a fixed mount, for easy disassemble, reflash, battery renewal etc.
    bild1.jpg
    bild2.jpg
    bild3.jpg
    bild4.jpg
    bild5.jpg
    bild6.jpg

    The Sketch

    // EgSlimReed2
    // By m26872, 2015-12-22
    // Interrupt driven binary switch for Slim Node with Reed switch and external pull-up (10Mohm)
    // Inspired by mysensors example:
    // https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino
    
    #include <MySensor.h>
    #include <SPI.h>
    #include <Vcc.h>
    
    #define NODE_ID 5 //12 var senaste "reed-node"-id // 110    // Use static Node_ID  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #define SKETCH_NAME "EgSlimReed"
    #define SKETCH_VERSION "2.0 2015-12-22"
    #define SW_CHILD_ID 5
    #define SW_PIN 3
    #define BATTERY_REPORT_DAY 2   // Desired heartbeat interval when inactive. Maximum heartbeat/report interval is equal to this due to the dayCounter.
    #define BATTERY_REPORT_BY_IRT_CYCLE 10  // Adjust this according to usage frequency.
    #define ONE_DAY_SLEEP_TIME 86400000
    #define VCC_MIN 1.9
    #define VCC_MAX 3.3
    
    int dayCounter = 0;
    int irtCounter = 0;
    uint8_t value;
    uint8_t sentValue=2;
    bool interruptReturn=false;
     
    Vcc vcc;
    MySensor gw;
    MyMessage msg(SW_CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      delay(100); // to settle power for radio
      gw.begin(NULL,NODE_ID);
      pinMode(SW_PIN, INPUT);
      digitalWrite(SW_PIN, LOW);    // Disable internal pull-ups
      gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      gw.present(SW_CHILD_ID, S_DOOR);  
    }
    
    void loop() 
    {
      if (!interruptReturn) { // Woke up by timer (or first run)
    	dayCounter++; 
    	if (dayCounter >= BATTERY_REPORT_DAY) {
    		  dayCounter = 0;
    		  sendBatteryReport();
    	}
      }
      else {	// Woke up by pin change
    	  irtCounter++;
    	  gw.sleep(50);  	  // Short delay to allow switch to properly settle
    	  value = digitalRead(SW_PIN);
    	  if (value != sentValue) {
    		 gw.send(msg.set(value==HIGH ? 1 : 0));
    		 sentValue = value;
    	  }
    	  if (irtCounter>=BATTERY_REPORT_BY_IRT_CYCLE) {
    		irtCounter=0;
    		sendBatteryReport();
    	  }
      }
    
      // Sleep until something happens with the sensor,   or one sleep_time has passed since last awake.
      interruptReturn = gw.sleep(SW_PIN-2, CHANGE, ONE_DAY_SLEEP_TIME);
    
    } 
    
    void sendBatteryReport() {
    		  float p = vcc.Read_Perc(VCC_MIN, VCC_MAX, true);
    		  int batteryPcnt = static_cast<int>(p);
    		  gw.sendBatteryLevel(batteryPcnt);
    }

  • 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.


Log in to reply
 

Suggested Topics

46
Online

11.4k
Users

11.1k
Topics

112.7k
Posts