31 October 2014
29 October 2014
A test of 24 hours should be enough to ascertain if the voltage loss is the same or less than it was previously. Before I made this change the circuit was losing about 0.27 volts per day which would give the battery a life of about a week with 2 second reads/transmits. Ultimately the sensor will be set to only wake up every 60 seconds, which will give a much greater battery life.
28 October 2014
After reviewing the code it would appear I was powering down the micro-controller but not the radio module. So after amending the code to ensure that the radio module was also placed into sleep mode (using the Lowpowerlab libraries, not the Jeelib libraries) I ran it for testing purposes again. Overnight the voltage has dropped 0.13 volts. Something is obviously still not right.
After some discussion on Twitter it would appear I should also be powering up and down the sensor. So instead of having it powered from the 3.3v power rail it should be powered by an output pin so the power can be turned on and off in-between reads and transmits. So, I will be amending my code to allow for this and then running further tests to see how this impacts the power loss.
I am aware that 2 seconds is a lot and as such the battery is not going to last years like that. However, I would expect even with 2 seconds per reading that the battery should still last a few weeks at least. Once I am happy that I am achieving this then the node will be set to transmit only once every minute to conserve power.
19 October 2014
18 October 2014
This is a breadboarded Arduino made up of the ATMega328p chip with appropriate resistors and an oscillator. Connected via SPI is the RFM69CW radio Tx/Rx module and via I2C is an HTU21D humidity and temperature sensor.
I've also added an LED to Digital Pin 9 to give a brief flash after each transmission as feedback the unit is working,
Everything is powered by a 3.7v 850mAh lithium rechargeable battery. The battery passes through an MCP1702 voltage regulator to give a nice stable 3.3v for all of the devices. I've added some sleep functions to the code so that in-between transmissions the MCU powers down for 10 seconds before waking and repeating the data transmission. This means for the majority of the time the transmitter is using micro-amps and then only milli-amps for a few milli-seconds. Overall a very efficient state which should easily give a battery life over well over a year.
The data packet contains the node's unique ID number, the battery voltage and the two sensor readings (Temperature and humidity).
I've got the circuit as small as possible on the breadboard (see pic). The next stage would be to transfer it onto a stripboard and solder it all together. Finally i'll design and etch a PCB. I could use SMD parts to make the entire thing even smaller still and swap out the ATMega for an ATTiny which is a smaller chip.
I want to make 2 or 3 different sensor nodes with varying sensors on them (temperature, humidity, pressure, luminosity, etc.) so i've got packets coming in from several nodes. This will then allow me to start writing the code for the base station which will receive the data, time stamp it, store it on an SD Card and then sporadically upload it to a web server.
I've got 433MHz and some 868MHz RFM radio modules and also an SRF radio module from Ciseco which claims to have longer range. These will be all tested out in time to see which is best for penetration through walls, etc.
17 October 2014
A quick recap - I first had lost packets and lots of CRC errors in transmissions. These turned out to be a bug in the Jeelib library. Then I put an L7805 5v to 3.3v rectifier on and found it wasn't suitable. This caused lots of problems with the radio. Changed that to an MCP1703-33 which is much more stable and better suited to battery operation too. That fixed those issues.
Then I found out that I couldn't connect any other SPI device to the BUS as the RFM69CW also uses SPI and is controlled via timer interrupts. This was corrupting comms over the SPI Bus to any other devices as the interrupt was hijacking the bus on regular intervals. I tried a DS3234 Real Time Clock IC and the data were all wrong. I could bit-bang another SPI bus on non SPI pins but this is a lot of extra work. Instead I opted to switch to an I2C RTC (DS1307). I'll make sure all the sensors I use are I2C to avoid any further problems.
So, now i've discovered the above limitations with the hardware and software and have a better understanding of what i'm up against i've made a lot of progress. The sensor nodes are now transmitting data successfully with no lost packets or CRC errors. I have yet to do any range tests yet or run them of battery (with power saving sleep modes), that is the next stage in the project..
11 October 2014
At first I had the units talking to each other and sending out test packets for nearly 24 hours with no issue. Then I started to modify my code and add functionality and they stopped working. So, I presumed I had broken something in the code and so reverted back to the RF12Demo sketch and my original code to test them again and they still didn't work.
So I rebuilt the circuit and started again. This time I had some limited success but it shortly started to fail again then stopped working altogether. I've swapped the radio modules over and still nothing.
I then started to use the RF12_easySend() function instead of RF12_sendNow() and the transmissions started to work. Then the receiver stopped receiving the packets, not even packets that failed CRC, nothing.
I've wasted hours and hours on this and it's nothing but frustration. Is it the Jeelib library? Do I have faulty radio modules? Who knows. I am at a loss what to try next.
09 October 2014
I left two units, one transmitting and one receiving, running overnight sending gibberish test data and this morning it was still running without one single lost packet of data.
A lot of time was wasted with that. Anyway, now it is fixed I am able to get down to the nitty gritty of connecting up a sensor and transmitting real live data over the network.
08 October 2014
Firstly, the receiver unit was correctly receiving packets for a while and would then stop receiving altogether or have large gaps where no packets were received. Then there were periods when the message kept failing the CRC error checks over and over. Despite the fact the units are only about a metre apart, I would expect perfect packets with minimal error and yet this is not the case.
I can only presume there is some kind of weird interference where I am testing. I did try to reduce the baud rate but when I attempt to use the RF12_control() command to set the baud rate I am getting compile errors. Some kind of issue with the RFM12 driver and Arduino 1.5.8
Overall it has been very frustrating.
05 October 2014
After doing a little bit of research it turns out that the Yun does not have its SPI pins broken out to the digital I/O pins as they are on the Uno and instead are only connected to the ICSP connector. So no wonder it wasn't working. After hooking up two modules to two Uno's they were able to communicate to each other successfully.
So, now I have two device communicating the next stage in this project is to hook up some sensors to one of the device and have it sending the data back to the base station device. After that, the circuit will be powered by battery and using sleep modes will sleep in-between sending data to conserve energy.
11 August 2014
The basic premise of the project is to have sensor nodes monitoring things such as temperature, pressure, humidity, light levels and so on and then send that data wirelessly back to a base station which will upload it to a web server. Nothing that hasn't been done before in one way or another but a nice project to get involved with.
So i'm currently researching various types of radio units, sensors, methods of battery conservation and so on that will be needed in the project. I will of course keep you updated with my project as time goes on.
10 July 2014
09 June 2014
So the build of my new Electronics lab/workshop/home office has begun. I'm starting completely from scratch and building a complete wrap around curved desk that covers 3.5 walls in a roughly square room. It's quite ambitious and will no doubt be a lot of hard work but I wanted something special instead of just square desks.
The plan is to have 3 work areas, one for me, one for Petra and a third larger maker space for our projects.
The room and desk will be white with hidden LED lighting to give it a bright and modern look. I want a kind of Tron flavour to it.
I've got all the wood and tools I need to get started so I'll be making a start tonight. I'll post photos of my progress as I go along.
Started to build the frame and then to cut out the worktops but found a problem with my router. The chuck wouldn't let go of the round over bit I was using and no amount of force would release it. The mechanism for locking/unlocking the bit is clearly faulty. So, the build is on hold whilst I take the router back to the shop to be replaced (plus get a replacement bit for the one that is stuck). Building will resume once I have my tools back.