N.B. Updated info and description to this project will be found here in first post of the projects MySensors forum thread.
- Version 2.0 [order] Now designed in KiCad. Now designed in KiCad. "Final release". I'm not developing it further atm, but I know others have some projects going.
- Version 1.4 Only known issue is wrong references due to panelization.
- Version 1.2 Some less convienient placed components and the panelized verision has a faulty via.
- Version 1.0 The one described below in this first post. Working but not panelized and lacks a few features.
This project describes a successor Node concept to my first 2AA battery sensor. I have combined a few simple design options to a result that I find rather useful myself and I think should be shared. The application specific sensor/-s of your own choice has to be added to this Node design, nor here any example sketches provided here. I use this design for all my door and window reed switches, temperature (calibrated internal or thermistor), LDR and similar simple sensor types. But, nothing prevents the use of more sophisticated sensors like Si7021 here as well. Infact here's a recent example.
- Simple, in the sense that it consists of a minimum number of components and common available material.
- Cheap regarding choice of components, assembly work effort, energy storage and power consumption (battery type and life time).
- Flexible universal design base equipped with various sensors. PCB pads used as port connections or prototyping area for extensions, i.e. border pads not connected to the uC (Avr) unlike e.g. Arduino Pro Mini (APM).
- Small and discrete clear white color to fit in confined spaces and to reach WAF level
And more concrete:
Hardware A "bare bones" ATMega328p 28pin PDIP (with or without socket). Bought from here and here. My reasons to not use Arduino Pro Mini here are
- The APM width is a little too big.
- APM has no prototyping pads near uC connections unless you accept to use pads connected to software inactivated ports (damage risk).
- Radio module connection has to be manually wired to the APM.
- Low power hacks like removing power led and voltage regulator are needed.
- Necessary support components (resistors and capacitors) are few and can easily be added to a custom pcb.
Software Since I prefer Arduino IDE for programming (flash) and debugging, I need a bootloader. Bootloader instructions are found all over the internet, but here's anyway how I do it. I use the "atmega328_1a.hex"(attached file) precompiled bootloader from here. It's an Optiboot with 1MHz internal clock and 9600 baud serial communication. Fuse changed to BOD disable. According to Gammon 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. I use Avrisp mkII avr programmer for fuse and bootloading similar to this procedure. Arduino as ISP, Avr/USBtiny or whatever any other should of course be just as good. Avr Studio 4.19 is a good choice for Avrisp mkII (perhaps for others too) and 4.19 is the last version before the gigantic (and for me useless) IDEs were released. I add the new board to my "boards.txt" (see attached add_to_boards.txt). Fuse settings (see attached 1MHz_optiboot_1a_-9600.png), and don't forget to set the lock bits (see attached lockbits.png). If programming a large batch, the ELF production file (see attached ELFwredring.PNG) is handy.
A standard NRF24L01+ radio module is used. The width align with the AAs and no mods necessary (like with my old node). As always I try to keep the antenna part of the module free from shading metal.
At first I planned the build on a proto board, just to stick to the cheap-and-standard concept. But with today's low prices on custom made PCBs, it wasn't any longer an option. Space, quality and work effort are so much more attractive. The board is tested (as a normal working MyS node) but not long term or thoroughly (every pad/port interference etc) so I leave no guarantees.
An important overall part of this design idea was to align minimum dimensions of the components and get rid of "expensive" parts like battery holder. It turns out (see below) that the enclosure's functionality as battery holder wasn't needed even though it was the initial idea. The mini trunking case has been discussed earlier, but rejected by some due to lack of ways to seal the endings. I still haven't the perfect solution, but I've since many years simply used (cheap) white tape. With some care it looks ok, and still does 5-10 years later. There are often proper terminators/endings to buy, but for some reason to unrealistic high prices. I used this cable duct with the dimension 17x20mm. Unfortunately it turned out that this particular type I used (Thorsman TMK T20) is now "professional grade" and dimension 17x20 is no longer very commercially available (read cheap) for consumers (here in Sweden at least). Professional stores sell it for 3.5-5.5$/m (preferably as a professional with discount). The 50m bulk batch could give some discount, but will give you 263 sensor nodes of standard length (19cm).
The Battery pack
Easy home made 2AA battery pack. Maybe it looks more demanding and time consuming than it is. (Usually its the other way around in my experience.)
- Start by taping the two (connecting) batteries together.
- Prepare the wires and make a small bun at the battery connecting ends.
- Attach the wires with tape.
- Tighten the cable ties and carefully note
- that the wires are pressed to make good contact with the battery poles
- how the cable tie ends must be placed to not steal lateral space
- that the wire from the bottom must be routed near the cable tie to not steal space.
- Make the pack more rigid by taping one or two times around at the top, bottom and middle.
- Trim wires and solder the female connector. If desired, leave at least a small part of one wire naked for current measurements. A battery change is done fast when cables a already made (use solid wires that preserves its shape). So why pay for a battery holder when you can remake a pack with fresh batteries in 1-2 min and your low power sensor will live 5-10 years before anything needs to be done?
Convenient there's the 6 pin standard FTDI serial interface exactly like on the Arduino Pro Mini. Perhaps it's mirrored here, but I think everybody double checks Gnd and Vcc before connecting. The Vcc and Gnd pins also serves as a connector for the battery pack. (CTS is connected to GND on the PCB.) "Under" the radiomodule are 3x2 pads for the AVR-ICSP pins. The idea was to have a socket for the nRF24L01+ instead of the "expensive" 328p socket and still have easy future access to the SPI/ICSP interface. Perhaps not very useful. But nice to have extra Gnd and Vcc pads in this end of the board for general purpose.
The Sleep Mode Power Consumption
Sleep mode current is
- 1.5uA when set to interrupt pin wake up (0 as last parameter to MySensors sleep() function)
- 5.8uA when set to timer wake up.