-
LLG PCB design
12/26/2017 at 22:25 • 7 commentsWhile dumb loggers are doing their job, I designed LCB for final LLG PCB. Concept was clear - all I need is CR2032 (obviously), small bare-glass LCD, appropriate MCU with LCD driver and a few kB of RAM, storage, photosensor and a few buttons. This all should form PCB for small portable device, capable of taking measurement of incoming light, calculating its own position and logging/displaying it on LCD.
I opted for PIC24FJ128GA306 as brainbox for this one. According to datasheet I should be able to achieve consumption 0,33uA for sleep mode, 0,4uA for RTCC with 32kHz oscillator, and 0,8uA for LCD driver with 1/3 bias plus 1uA for resistor ladder, together roughly 2,5uA for device doing its job, though mostly sleeping and displaying stuff on the LCD. With LCD off, the figure should be around 0,7uA.
The logger with wake up every few seconds to take measurements, let's say it's every 10s. If measurement will take under 10ms (it definitely will) and will take under 1mA, the duty cycle ratio will be less than 0,1%, meaning less than 1uA of average current consumption. Let's consider it is 0,5uA, I can expect battery life roughly 9 years for mode with LCD constantly on and displaying stuff and 23 years with LCD off, way above shelf life of battery.
I had more devices in consideration at this point - I thought of PIC18F67K90, but the PIC24 part should have somehow lower current consumption. I considered MSP430 devices too, but somehow I couldn't find devices with 4 or 8 kB of RAM, LCD driver and sane package (TQFP48/64). STM32L looked promising, but after not exactly short digesting of their datasheet I learned their current consumption in this application would be higher than that of PIC24.
For LCD I opted for small 8-position seven-segment LCD, DE-188. It has four backplanes, but the driver in PIC should be able to drive eight of them, so I'm set. I was careful to select model with 3V driving voltage.
For dumb loggers I chose for 24LC64 EEPROM as storage, one of reasons being I had a lot of them. I2C devices are not particularly good for low-power applications. Open drain nature of communication lines means that the current flows for approximately 50% of communication duration. Interfaces like SPI are somehow better suited here, with totem-pole output, so I selected 25AA256 as storage device. It should have enough of capacity for a few years worth of logging, with simple upgrade path to higher capacity density.
For light sensor I'm not yet completely determined, but it looks like I'm going with LDR for now. The PCB design will allow using photoresistor too.
The rest of things was quite straightforward, buttons, some pull-ups, crystal, decoupling capacitors, with final PCB being 50x50mm (50mm equals to 1 and 62/64 of inch) yet being not exactly crowded.
Most of components and traces are on bottom side, with top side being populated by buttons, LCD, photo sensor and battery.
The contest deadline is in less than two weeks and most PCB houses here do have their offices closed up to early January due to holidays. Fortunately, friend of mine is able to produce double-sided PCBs with soldermask (no metalized vias, though) so this should save me. Let's see in next log in a few days.
-
Half of loggers on the way, half in place
12/18/2017 at 15:17 • 0 comments -
Light loggers
12/13/2017 at 21:12 • 0 commentsYou have to walk before you can run - also, before I define algorithm to calculate dusk/dawn times to provide geolocation output, I should collect some experimental data first. To find out how the light level changes over time in different parts of the world (well, EU to begin with) I had to build small, battery powered loggers I can send via postal service to volunteers.
In order not to lose any precious time, I decided to start with simplest option for me - PIC16 family. I took a look into drawer and found half a dozen of PIC16F1825, being good candidate for this project. Tube of 24LC64 EEPROMs, fine. I couldn't decide what light sensor would be good for this. I found handful of various photoresistors (light dependent resistors - LDR's) also some phototransistors, so I decided to use both and log output from both of them, so I can decide which fits better the LLG project.
In order to achieve low power consumption, the MCU has to be in sleep mode for most of the time, waking up in periodic intervals to check time and perform action, if needed. Here it runs briefly from internal 500kHz oscillator and falls to sleep, allowing only Timer 1 to run from external 32kHz crystal and divider by two. Once it overflows (after four seconds), the PIC wakes up, checks whether 90 wakeup events (90x4s = 360s, that is 6 minutes) elapsed since last log. If yes, it raises logic level on pin RA2, waits a bit, measures voltage on both analog pins, writes results into EEPROM and falls asleep again. If memory is full, then enters idle mode. That's it. There is no memory readout, I have to pull EEPROM out of socket and read in EEPROM reader.Average current consumption is 23uA, so loggers should be fine for about one year - but meh, it's one week mission. Unfortunately, I didn't have low-voltage version of MCU at hand, PIC16LF1825. That should achieve consumption about 1uA, so battery should be fine for more than its shelf life. For final LLG project I'll sure use low-voltage version of chip.
Hardware was done on protoboard, being the fastest prototyping option for me - I built four pieces for two hours.
Bottom side with usual wire links
Once loggers were built and tested, packaging was another problem to solve. Ideally, it should withstand being outside, probably withstanding rain and so; for couple of days. I bought a few food containers
I collected used desiccator bags, heated them for 8 hours at 120 degrees Celsius to refresh them at least partially, put logger into zip-lock bag with the desiccator, then put into another bag, inserted into box and stuffed with some relief sheets. The box was sealed with hot-melt snort and inserted into another bag. I expect the bags and sealed box to keep humidity outside the box and desiccant package to remove internal humidity that could otherwise condense on PCB - at least for a few days. Fingers crossed.
Four enclosed loggers:And ready for journey
-
Getting pen friends to obtain more experimental data
12/12/2017 at 22:08 • 0 commentsI have a few ideas in mind how to make the algorithm to determine the dawn/duck time (don't forget this algorithm has to be lightweight enough to fit on low-power MCU), but taking a measurement in single place, fit algorithm to it and call it done is not the way I like to do things. I decided to find a few "pen friends" and send them loggers to make record of light intensity and then, return it back with measured data. For now, the logger will not and can't do any geolocation, as I still don't have any algorithm, but those raw data will help me to find one and validate it. For now I have two volunteers in here, in Slovakia; one in Germany (thank you @davedarko ) and one in Spain.
-
Light level geolocation method
12/12/2017 at 21:43 • 0 commentsLight level geolocation (LLG) is based on what I called "Australian paradox" when I was 8 years old - like, they have long summer days while we have short winter days. Being on different hemisphere than kangaroos make the difference very obvious, but smaller changes in latitude do have also impact on day length; though with smaller granularity. Changes of longitude are apparent as time zones. By measuring time of dawn and dusk against precise clock and date, one can determine the longitude (when dawn or dusk happens) as well as latitude (day length - difference between dawn and dusk).
This looks trivial with any light sensor, like photodiode or light dependent resistor and real-time clock, but devil is in details, as usual.
- This way of geolocation is slow. GPS can get fix in order of seconds or minutes, LLG in order of days, no less than half a day. There is nothing we can do about it.
- This way of geolocation is also not exactly accurate. GPS has accuracy of meters, LLG in kilometers, up to dozens of kilometers. There is something we can do about it - like having clear view to sky and not much artificial light pollution.
While GPS looks like no-brainer decision here, LLG offers some advantages too:
- It can be really cheap and low power. It can run and log for years from single coin cell battery.
- No other advantages, but having just one point in this list seemed inadequate.
These points made LLG to enter its use for animal tracking (birds, sea animals), where usually one location per day is enough and the accuracy is fine to observe migration across continent.
There are some scientific papers available, but as usual behind the paywall (thanks to Sci-hub one can retrieve it and take a look) and are more like information of what can be done, with little to no secret sauce of how to do it. LLG doesn't seem to be very popular outside bird tracking circles, though it has some potential as low-power backup tracking autonomous vehicles or ships, for example. I believe it can be interesting to try to make open-source implementation of this method.