I've finally managed to get the Bluetooth thermometer up and running; there are still a number of improvements to be made and features to be added but as it stands I can put power into the breadboard and get temperature readings out of RealTerm, so the basis of the system is operational.
Once it was up and running I took a few current measurements and was a little concerned; here's what I found:
Link connected but idling: ~20mA
Link connected and transmitting: ~22mA
Here's the kicker though - when power is first applied and the link is trying to connect to the PC the power consumption jumps back and forth between roughly 2mA and 50mA once a second. It seems like the "search" mode is the most power-intensive state, which could pose a bit of a problem. If the PC is waiting to accept the incoming connection the "search" routine will only take five seconds or so, after which the current draw drops down to the 20-22mA range. The danger is that if the PC is not ready to accept the connection (powered off, Bluetooth disabled, connection in use), the module will continue to "search" indefinitely, eating up the battery.
The Sure Bluetooth module doesn't have a #SHUTDOWN or similar pin, nor can it directly provide any direct link status indication, however it does have RTS and CTS pins, which we just might be able to make use of to see if the link is connected, and if it isn't, switch the power to the module off via a MOSFET for a predetermined amount of time, then try again.
Here are some of my other ideas:
Configurable "Sessions" - For the first thirty seconds after power-up, the PIC would look for any ASCII data coming in over the Bluetooth link. If anything was received, it would answer back with a "setup menu" that would allow you to change settings such as the initial sample count, sample frequency, etc. Once these values were set through the terminal, they would be saved in the EEPROM and the rig would start collection and transmitting data according to the parameters you entered.
This would be much more convenient, as right now the only way to change the behavior of the device is to modify the source code, compile it, and load it in with a PIC programmer. The "boot menu" concept lets you easily modify the settings without any hardware or software whatsoever (just your terminal program).
Some of the configurable values might include:
- Sample Frequency (currently fixed at one sample per second)
- Initial Sample Number (currently resets to "0" at power-up)
- "Search" timeout
- Temperature Scale (Centigrade or Centigrade - If you're using Fahrenheit you're not invited)
That's about it in terms of news for the thermometer project; I'm going to have to work out a the details for the power supply next: I'm thinking something simple like a LP2950-3.3V should do the trick. I'm still trying to figure out how well all of this is going to run off the solar panel, the spikes at power-up can be counteracted with a supercapacitor, it's the continuous 20mA idle current that I'm wondering about...
In other news - my apologies to the folks at Neilsen-Kuljian: it is in fact my software that sucks, not their current transformers. I was having a discussion with one of my instructors at school today when it hit me: The PIC is running off of +3.3V, and therefore the A2D range will be dependent on the rail-to-rail difference of the PIC's power supply. In every project I've done in the past, I've powered the microcontroller off +5V, and had that been the case here my current measurements would have been correct, however, as the PIC's A2D in this situation tops out at +3.3V it makes perfect sense that a CT output voltage of 3.7V would give and answer of 10A!
Now that that's out of the way, I still need to find an accurate way to measure the AC line voltage and get a proportional 0-3.3V output voltage that I can cram into the PIC to compute power correctly.
I owe David (my instructor) thanks for providing feedback on my proposed measurement schemes; as things stand it seems we're still in limbo as to what would be the best way to go, I'll keep everyone posted.