Infrared camera trigger experiments

Wouldn’t it be nice if I could take a picture of a bird as it passed through an invisible beam of light? The idea’s not original, these things exist, but they are quite dear, so I am experimenting with making these.

The most obvious way is a light source and a photocell, and indeed many years ago at secondary school I developed an analogue circuit[ref]people normally consider monostables as digital but mine was built using discrete transistors and resistors, and the time delay was infinitely variable, as it would be with a CMOS 4538, so I consider it analogue[/ref] using OC71 transistors scavenged off postwar computer boards to make up monostable multivibrators for the delay elements  and one with the black scraped away from the housing to act as a phototransistor.

Not bad for a school project from 1976. It looks better as an animation than a sequence of stills.

This gonzo technology of 40 years ago triggered the flash for the source negatives used in the animation – you set a very slow drip, and as the drop passes the photocell it triggers the delay. By increasing the delay between the drop passing and the flash going off you get the progressive animation, assuming each drop makes a similar pattern.

1508_OC71
OC 71

This was done with a manual camera, a new Canon AE1 ISTR that one of the other kids had. But the trick is to do all this in the dark, click the camera on Bulb and use the trigger to trip the electronic flash, which responds within milliseconds and has a short duration of about a millisecond if you reflect some of the flash back into the photocell of the flash (to turn it off as early as possible).

So there’s nothing incredibly hard about doing this, in controlled conditions, in a darkened room. If I were doing it again, I’d do it in the same basic way, using a phototransistor and a CD4538 CMOS dual monostable rather than a discrete monostable – one half to give the delay controllable with a pot and the other to make a pulse off the falling edge to go into a NPN transistor to trip the flash. There’s no need to muck about with PIC microcontrollers or Arduinos though you could do it that way if you really have to for a higher cost plus the aggravation of writing code, plus the jitter of the Arduino sampling the sensor/responding to the interrupt. In high-speed photography sub-milliseconds matter.

Everything gets harder outdoors

Outdoors you have massive and variable amounts of light from the sun, distances are longer, there’s just a whole lot more hurt all round.

Continue reading “Infrared camera trigger experiments”

Measuring paramagnetism 3 – a portable instrument

In Part 2 I described a flat coil sensor which changes inductance according to the magnetic susceptibility of what is in front of it. To make this useful in the field I need something to display the change.

the field instrument
the field instrument. The black button stores the calibration frequency with no sample, the red button takes the reading and displays the result after 4 seconds

I was going to count the high-frequency microcontroller clock over, say 500 periods of the low-frequency sensor signal. That turns out to be a terrible way to do this. I don’t have the gear to measure it, but I suspect the jitter from slicing the 1.5kHz sensor signal is too high. The result is that the third significant digit twitters a lot. By counting changes in the sliced sensor signal (thus doubling the frequency) over a fixed period I get the twitter down to one part in >12000 counts1 over a four-second signal acquisition time. Continue reading “Measuring paramagnetism 3 – a portable instrument”

Wildlife camera with Raspberry Pi, Motion, and temperature sensing

I’m toying with the idea of going along to the Ipswich Raspberry Jam on Saturday 8th Aug and figure it’s be nice to have something to show. There’s of course our farm Raspberry Pi cameras which are in service and this one is riffing a bit off an idea Wildlife Gadget Man is playing with. He’s the guy with the wildlife – I only have sparrows[ref]I like my sparrows but they aren’t going to pose long enough for the camera, and presumably they have their heads under their wings in a hedge somewhere now, a hedgehog in a hog box is the sort of target that would work well here[/ref] so I have to make do with a stuffed toy stoat 🙂

stoatpi

temp

There’s nothing earth-shatteringly new in here, but the ability to make a box which gives you video, snapshots and a temperature plot taken from one of those Chinese waterproof DB18B20 probes is good for mammals.

Continue reading “Wildlife camera with Raspberry Pi, Motion, and temperature sensing”

Using near IR to look for photosynthesis and plant health with NDVI

The NoIR Raspberry Pi camera comes with a blue filter to do near infrared photography – the blue filter ices the visible red but passes near IR which records as red, apparently.

NDVI image of something in the polytunnels
NDVI image of something in the polytunnels. Should have made a not of what this plant is 😉 Anyway, more red and going to magenta white overload=more photosynthesis

NDVI (Normalized Difference Vegetation Index) is the near IR plus red divided by near IR minus red. Take a look at this image for the meaning of the colours – red, magenta and white is more photosynthesis, cool colours and black are less. Chlorophyll uses red but doesn’t use near IR which it reflects, hence the difference carries useful information.Lots more at Public Lab. Continue reading “Using near IR to look for photosynthesis and plant health with NDVI”

Measuring paramagnetism 2 – a new sensor

Part 1

Since I will be taking the sensor to the rock I’m going to temporarily give up on getting an absolute measurement, and take a leaf out of Bartington’s book from last time and use a flat coil. I will never be able to contain the sample in the magnetic field1 as I might be able to in a solenoid, to the effective susceptibility will always be lower than 1. One day I may be able to calibrate this and find a fixing factor, but for now I will look for relative differences.

Continue reading “Measuring paramagnetism 2 – a new sensor”

Measuring paramagnetism

There are two approaches to measuring paramagnetism that seem to be common. One is to use a balance to measure the slight attraction to a magnet – put sample in a balance, apply magnetic field, look for difference in weight of sample using a Gouy balance or use a torsion balance to observe the attraction in a horizontal plane which takes out the static weight of the sample.

The trouble with these two is the attraction due to paramagnetism is weak compared to the weight of the sample – these are lab bench instruments and the electromagnet consumes a lot of power. Although taking samples of soil is easy enough to bring back to the lab, one really shouldn’t be taking a hammer and chisel to ancient monuments to get a sample for a Gouy balance 😉

It's not really right to go chiselling a lump off this to insert into a Gouy balance...
It’s not really right to go chiselling a lump off megaliths that have survived thousands of years to insert into a Gouy balance…

The other way of measuring volume magnetic susceptibility is to stick the sample into a coil and measure the inductance – with a different configuration  of the coil as a search coil it can be used to measure susceptibility at the rockface.

Continue reading “Measuring paramagnetism”

Weatherizing a Raspberry Pi Camera with a Microscope slide

Sticking a Raspberry Pi camera exposed to the elements doesn’t do it any good over time, resulting in the hazy crazed lens problem.

Flare on the camera lens after a year in the open
Flare on the camera lens after a year in the open

The solution is to put some glass in front of the lens – and indeed this is exactly what this commercial outdoor spec little lipstick CCTV camera does

it's hard to see, but there is a round glass against an O ring in gront of the camera lens on this weatherpoof camera, which has spent several years outside and still works well
it’s hard to see, but there is a round glass against an O ring in gront of the camera lens on this weatherproof camera, which has spent several years outside and still works well

I discovered this when I took it apart to unscrew the lens a bit to make a close focus. And then cracked the glass refitting it as the lens stuck out too much. If you ever need a flat round piece of glass, search for watch crystal on ebay and they are to be had in lots of diameters. A watch crystal is apparently a term for the glass on a watch as well as the 32,768 Hz timing quartz crystal. A flat watch crystal repaired this camera.

The direct exposure of the camera lens to the elements is the biggest weakness of the now-defunct PICE weatherproof Pi case. But it is easily rectified now, using a piece of flat glass fitted with Sugru or Milliput putty. I used sugru and a cut down microscope slide, since I didn’t want to buy another watch crystal when microscope slides are optically flat and cheaper. It is a lot easier to cut glass under water, and you can remove the viciously sharp edges using a cheap diamond sharpening stone to smooth the cut edge and chamfer the corner.

Microscope slide fitted with Sugru to shed the water and seal the camera from the elements
Microscope slide fitted with Sugru to shed the water and seal the camera from the elements

Continue reading “Weatherizing a Raspberry Pi Camera with a Microscope slide”

Aspirated air temperature sensor for a Polytunnel

In the UK air temperature is normally measured in a passively cooled Stevenson screen. The louvred design of the screen allows air to flow around the thermometer. The trouble with a polytunnel is there is no wind at all, as a result the sun heats the sensor up and without airflow you don’t know by how much.

By running a computer fan driven off a solar panel I can move enough air past the sensor to exchange the heated air from the sun shining on the sensor. For the sensor I use the standard Chinese supplied DS18B20 encapsulated in a stainless steel tube

Dallas DS18B20 epoxied in a stainless tube housing, from a Chinese Ebay supplier
Dallas DS18B20 epoxied in a stainless tube housing, from a Chinese Ebay supplier

The sensor is housed in a 6cm piece of white plastic waste pipe

sensor mounter in centre of white waste pipe
sensor mounted in centre of white waste pipe

The fan is mounted at the top of the pipe, designed to pull in air from below; this way the sensor is not heated by air passing the fan motor, and the airflow works with the natural tendency of warm air to rise. I’ve tried to keep the airflow as unimpeded as possible.

side view - the flange for the fan is made from a piece of wood glued to the pipe
side view – the flange for the fan is made from a piece of wood glued to the pipe

Looking at the results there is a difference of a few degrees

the difference opens up a few degrees at high temperature

between the aspirated sensor and another sensor mounted on the outside of the plastic tube. They track at low temperatures but not when the sun is shining – the difference here is about 6 degrees, even in March, before the vernal equinox. It is remarkable just how much the air temperature swings – 27 degrees on a couple of days which still have hazy sun.

Sensor mounted in polytunnel
Sensor mounted in polytunnel

Weatherproofing the sensor is easier in a polytunnel because as well as the wind not blowing, it also doesn’t rain. I can use a cheaper indoor solar panel, the one I used is a 12V 1.5W unit, Maplin L58BF bought on sale for about £6, not the £20 they seem to be charging for it. even £6 is a little dear! I extracted the flashing blue LED and series diode to maximise the power available to the motor. This also charges the battery of the temperature sensor dual unit, which reports back to the collecting station using Ciseco’s XRF every 10 minutes.

Solar panel schematic
Solar panel schematic

The computer fan was a 12V brushless unit but I run it at about 7V, we’re not after blowing a gale through the tube. It will start at 5V. The Zener is there to limit overcharging of the 4.8V NiMH battery pack in the electronics to about 4mA. It only reports every 10mins so this is enough. The 1N4148 diode stops the battery discharging back through the fan and solar panel in the night. I should really measure what the leakage current of that Zener is 😉

I used a PIC 16F628A driving a Ciseco XRF to send the temperature data from two sensors back. Nowadays I would use the Ciseco RFu which includes an Arduino and low-power standby mods to make this cheaper.

Other implementations

This is a nice weatherproof design – I can’t work out if I missed a trick with using just one plastic tube rather than a coaxial design. Lots more ideas here.

Postscript (July 20 2015)

five months of data
five months of data

This rig works reasonably well; if power were available I’d run the fan all the time in daylight for a more rigorous result on summer cloudy days. The biggest problem in a polytunnel is that they are shockingly dusty places, and you have to sponge the dust of off the solar panel every month or so.

The Texas LP2950 oscillates as an adjustable regulator

Nowhere in the datasheet does Texas tell you “hey use this fixed regulator as an adjustable”. However, I’m used to being being able to do that with the venerable 78XX series – indeed Texas tell you that you can do that with the 78L05 datasheet in Fig 14.

Adjustable 78l05. bear in mind the shocking Iq of 3mA that'll stand you up an extra 3V if resistor R2 is 1k, keep 'em low...
Adjustable 78l05. Bear in mind the shocking Iq of 3mA that’ll stand you up an extra 3V if resistor R2 is 1k, keep ’em low…

Given that there’s an adjustable variant of the LP2950 that appears on the same datasheet (the LP2951) I laid out a PCB and being the lazy sort I am I assumed that since I was using a load of these parts in their 3.3V KY5033 variant, where I wanted an 8V stabilised voltage for an audio mic amp sourced off a 12V supply I can simply do the LM317 trick, drop in a couple of resistors from the output to ground and the ground pin to real ground, job done.

what I planned...
what I planned…

For this I made R1 6k8 and R2 10k.I expected an output voltage of 3.3+3.3/6800*10,000=8.2V or near enough. I screwed up labelling the o/p 10V, mistakes happen…

What does that look like then?

Oy vey, about 4V of massive oscillation (I’m using 10x probes). At least it’s centred on the right value-ish. Let’s take that output capacitor out

1503_lp2950_openLooking good, only 1V of oscillation, now at 370kHz or thereabouts.

So if you come here from Google wanting to know why the LP2950 doesn’t work as an adjustable reg, now you know. There is a tiny clue in the datasheet in the ground current variation

LP2950 variation in ground current with output current

which varies by two orders of magnitude with a load current variation of 1000. This will be impressed upon R2, varying the target voltage – as more current charges the capacitor the target voltage will rise, then ease off as it is charged, making a handy relaxation oscillator.

There’s another clue that the output cap can give interesting results in this line

1503_2950_cap

which actually specifies a ESR range, rather than less is better

No criticism of Texas’ product implied – these are great little fixed voltage regs with a low quiescent current and are my goto device for running 3.3V devices off a 5V rail because of that superb dropout voltage of 600mV max, across the entire range of load current and -40 to 125°C which is easily in spec off a 4.75V min 78L05. It’s just one less thing to worry about. Im future I won’t be a doofus and try and use one where a LM317L is called for 😉

 

Raspberry Pi Camera and Motion out of the box – Sparrowcam

The idea is simple enough – a bird feeder camera on the network, using the Pi and associated camera. Using motion detection software I can pick out the birds. Of course I will also get the feeders swinging in the wind 😉

Although this is about running motion I can use videolan instead to stream the video as a netcam and use motion on a second machine. Videolan streaming

cvlc v4l2:///dev/video0 --v4l2-width 640 --v4l2-height 480 v4l2-chroma h264 --sout  '#standard{access=http,mux=ts,dst=0.0.0.0:8082}'

is nice on the Pi, because it seems the camera can do the h264 in some sort of hardware/accelerated mode in the V4l driver. I can then watch the birds with realtime update rates on my LAN. That’s for another day…

width 1296 looks okay
Spadgers

Up to about mid 2014 it used to be a load of hurt to run Motion and the Raspberry Pi camera because there were no videoforlinux drivers for the camera. That way you don’t get a /dev/video0 for the Pi Camera and needed workarounds for Motion.

Now there is a driver which you’ll already have on a Raspbian install, and it’s easy to use. right out of the box. Continue reading “Raspberry Pi Camera and Motion out of the box – Sparrowcam”