Q's Project Blog
Tuesday 1 October 2024
Friday 10 June 2022
A Proton Precession Magnetometer - Part 1: Overview and Polarisation Coil
A Proton Precession Magnetometer - Part 1: Overview and Polarisation Coil
It's got a lot to really great details, full schematics and lots of photos. I'm going to use slightly different technology in places (since it was written in 2007) but the basic idea is the same.
Wednesday 28 October 2020
LoRat Rat Trap Monitor - Weather proofing, battery life and software updates
After leaving a couple of the rat trap monitors in place for a few months it soon became apparent that weatherproofing was going to be an issue. In fact, I've learned a lot about how to have electronics outside, how to maximise battery life and how to iterate on a product design.
The major issue was weather-proofing. My original idea was to use repurposed "Eclipse" mint tins. These are about the correct size to hold the PCB and have a handy hinged lid that by eye at least seems to seal quite well. Unfortunately, it soon became apparent that "quite well" is not good enough. Although the LoRat devices are in tunnel-like rat trap boxes, the ends of these are open and the LoRat and it's antenna needs to be near the open end of the tunnel. After a few months of sitting out in the garden, each of the prototypes had become unserviceable and signs of water corrosion were visible on the LoRa module.
Although there is no shortage of "true" ingress-protected enclosures, such as these gasket sealed ABS boxes from Jaycar, these are fairly expensive and would cost as much again as the rest of the parts. Instead, I decided to go with these simple Sistema food storage boxes. These have room for the PCB and for a 9V battery and I've been using a simple rubber gasket to seal the opening required for the antenna and one of these waterproof toggle switches for power. The box is attached with a short length of aluminium angle that is screwed onto the trap. Originally I tried epoxying the food storage box to the aluminium but this was difficult to get good adhesion, even after roughening the surface of the plastic. After lifting up the trap by the box and a few times the trap was set off, I found the plastic box would detach. I'm now using some M3 bolts and washers and these seem to be able to be tightened enough to keep it secure and protect against water. Finally I've been using a small packet of self-indicating silica gel in the box as a "last resort" defence against moisture.
The move to using a 9V battery, however, bought its own challenges. Even with the Arduino Mini in low-power mode and the indicator LED removed, a 9V battery only lasted six weeks. That's starting to get a bit expensive and wasteful. The big problem is the low capacity of a 9V (400-500 mAh) and the fact that the Arduino Mini has a relatively inefficient voltage regulator on the board. This hardly matters for most applications but in this situation where the microprocessor is in low-power mode it becomes quite significant. My solution has been to make an additional small PCB with a separate low-dropout regulator with a very low quinesent current. The MCP1703A has a 2.0 µA quiescent current.
17 August 2020 04:03:13 | CASH03 |
16 August 2020 16:09:28 | CASH02 |
13 August 2020 20:24:31 | CASH03 |
13 August 2020 20:23:51 | CASH03 |
12 August 2020 23:50:14 | CASH03 |
09 August 2020 20:02:17 | CASH03 |
Thursday 5 September 2019
Twilight Photometer Part II - Analysis
The basic idea is that as the sun sets, or rises, it sweeps a beam into the atmosphere that illuminates a segment of the sky above the photometer. By analysing the gradient of light changes directly above the photometer and calculating the sun shadow height it is possible to reveal the presence of any high altitude aerosols. The following diagram, from the original article, shows the theory of it:
In the original article, Forest Mims provides a spreadsheet that he uses to analyse the data. Based on this and a similar one from the NOAA I created a Python module to do the solar calculations. The calculations are quite intricate but it's fascinating to see how given the date and latitude and longitude it's possible to calculate the sun shadow height (and a lot of other interesting things such as sun azimuthal angle and sunset time). I have a series of Python scripts which work together to:
- Download the data as a CSV file from the Photometer
- Add the observations to an SQLite database
- Generate the plots of shadow height vs intensity and intensity gradient.
Monday 29 July 2019
Twilight Photometer Part 1 - Construction
A few years ago he wrote a couple of articles in Make Magazine about Twilight Photometry. These really caught my imagination - the idea that what was essentially an LED pointed into the sky being able to detect aerosol layers tens of kilometres up seemed fascinating. Of course, the Devil is in the Details and there are some important considerations to get this to work. It's taken some years to get around to it but I've finally found the time to get started on this project.
The keys parts of the photometer are simple - a circuit to amplify the tiny current created by the LED as it points at the twilight (or dawn) sky. To do this requires a low noise amplifier with a very high gain circuit. This requires resistors in the GΩ range. These are by far and away the most expensive resistors I've ever purchased at $10 each!
Following the schematic in the Make article and Mim's related book, I used KiCad to design and layout a small PCB. The files for this are available on GitHub.
Mims suggests that the LED, capacitor C2 and resistor R1 should be soldered directly to input, pin 2 of the TLC271 in order to reduce noise. I'm hoping that because I'm on a "proper" PCB with a ground plane that it will be sufficient to just use the PCB connections as normal. I can always re-engineer it if the noise is a problem.
I followed Mim's suggestion to install everything in a metal enclosure and to make the LED mounted in a removable fitting. In my case, I used a metal 6.5mm phono plug which holds a LED and a piece of brass tubing (with some black heat shrink extension) as a collimator quite nicely. I've set up both red and infra-red LEDs in phono plugs and these can be swapped out.
Data is collected using an Arduino and the excellent Adafruit Datalogger shield which contains both an SD card and a Real-Time Clock. Like all Adafruit products, it's well documented, robust and well-thought-out. As an interface between the output of the amplifier, I used the 16-Bit, 4 channel ADC also from Adafruit. This is an I2C device, easy to use and seems accurate. Since I'm running everything off 5V (supplied by the Arduino) there's not a lot of voltage range but hopefully, the 16bit ADC (running at 0.0635 mV resolution given the 2V full range setting ) will be sensitive enough.
The code for the Arduino is here. It's pretty straight-forward, several readings are taken for each channel and averaged giving a recording time of about once every second. One notable thing is I added the ability to download the datafiles (YYYYMMDD.CSV) from the SD card over a serial connection to my laptop which saves constantly having to open up the enclosure and get the SD card out.
Here are some photos of the final enclosure:
Since there are three "unused" channels on the ADC I've added three additional LEDs (each in clear housings) attached to those channels as described in "Atmospheric Monitoring with Arduino". I did a test of various LEDs - using an RGB LED to generate various colours and measuring the response.
The response curves are not ideal as clearly a couple of them are saturating fairly easily but it seemed blue, yellow and red gave the best spread so I've used those. Daylight photometry is kind of tricky since there tends to be shade from ground features and clouds at some time during the day. At the very least I may be able to get some full sunshine measurements around noon for some days of the year.
Finally I decided to add a ground stake to the enclosure to keep electrical interference to a minimum. Here's a picture of it all set up on my deck on the first night I tried it. It's powered by my 'portable' SLA/Solar power box I used for water pumps and the like around the garden - the solar controller has a convenient USB output. You can see I mounted the photometer on a piece of plywood with a levelling mechanism made of some embedded threaded rod and some bolts. The ground stake connection goes off to the right and into the garden.
This was not an ideal night, a little hazy and with some low cloud to the west of us. However, a brief look at the data looks promising - if anything it might currently be too sensitive and need a longer tube over the LED as it was at its max reading until about 10 minutes after sunset but then steadily decreased over the 45 minutes. I'm keen to collect more data but we've had day after day of clouds. Here's hoping for a nice clear frosty morning or evening soon!
Part II will discuss the analysis of the data.
Friday 12 October 2018
LoRat Trap Monitor. Part 4 - PCBs and Antennas
More importantly they seem to work. I found that there is an issue with the footprint for the SMD u.FL antenna connector which I have fixed for "next time" and also added some holes for direct antenna wire connection. However I'm unlikely to use the u.FL connector as simply a piece of wire or one of the coil antennas which comes the LoRa modules is likely to suffice. The part I was most concerned about - the SMD footprint for the LoRa module, seemed to be spot on and was not hard to solder - just run a fillet of solder up against every pin and remove any bridges with wick.
After that excitement there was a fairly long gap in this project as I was busy at work and ski season meant we were away many weekends. All that time I still had my prototype out in the garden attached to a rat trap. Sadly there are no rats around at the moment, in our garden at least. At the same time I do check it from time to time and set it off manually to confirm the batteries are still good and the receiver is still running. There have been no false positives so far.
Before I did that I wanted some way to estimate range. To do this I use built simple device using a Arduino Uno and a I2C LCD screen connected to a LoRa module. Code for this is on github. Faced with the difficulty of cutting a square hole, neatly, for the LCD I decided to have an enclosure laser cut out of acrylic sheet. This the first time I've tried anything like this, but it worked out pretty well. I used this box generator to generate the starting point for the design. A couple of bolts and standoffs keep the thing together, although I later added some plastic adhesive around the base.
When the test button is pressed it generates a random number then sends that to the base station and waits for a reply. If it gets the same number back in response then it prints the confirmation of that and the signal strength:
The science of antennas, for LoRa along with other radios, is pretty complicated. There's a lot of information on the Internet, some of it contradictory. I had bought this antenna off Aliexpress but wasn't really convinced it would be a good outdoor solution. In the end I decided to build a quarter-wave ground plane antenna as described here. That site also has a very useful calculator so I could cut fives pieces of single core copper wire taken from a domestic supply type cable and use a SMA->TNA adapter I got off TradeMe. This conveniently has four holes which can be used to bolt on the ground planes.
The pieces of wire are not super straight but I assume that won't matter too much. Along with a home-made 2m coaxial cable my initial tests showed it was slightly better than the antenna I bought off Aliexpress.
The antenna sits neatly on top a piece of 15mm pvc tube which then serve as a mounting post:
Initial tests suggest I get pretty good coverage all around the neighborhood. But I'll be trying to quantify that over the next few days.
Monday 6 August 2018
LoRat Trap Monitor. Part 3 - PCB design
The schematic is pretty straight-forward:
As is the resulting board which is about 34 x 65mm:
This should fit inside one of the candidates for a repurposed enclosure - an "Eclipse" mint tin.
Design files are available on Github.
I created some custom footprints for the LoRa module and the U.FL antenna socket and these are also available on Github. The LoRa module is quite tricky and might be difficult to solder but we shall see.
I'm having prototypes made at both OshPark and PCBWay simply for comparison. The latter will turn out quite cheaply as long as a cheap shipping option is available.
A Proton Precession Magnetometer - Part 2: Sensor Coils Somehow two years has passed and this project has languished. But I've finally...
-
The PCBs arrived, first from PCBWay and not too long afterwards from OSHPark . They look pretty good. Although the classic purple from OSHP...
-
Background In recent months I've become interested in predator control in our neighbourhood. New Zealand native birds, reptiles...
-
I'm a big fan of Forest M. Mims III. Not only has he published some excellent reference books such as his charmingly hand-drawn Engin...