Other sensors

Moisture sensor

I want to measure the moisture in soil.  This could be used to switch on watering for plants in pots, for instance.  But I also want to measure actual soil moisture in the field.

I bought a cheap i2c capacitive moisture sensor from Cool Components for less than £10 including postage.  I had to get a socket with leads too (a Grove 4 pin) as the standard Dupont cables are slightly too fat to fit in a line together. I just had to snip off a locking tab to make it fit.

I tried connecting to a pi that had the Buster o/s but this was too old, so I connected it to the pi with Bullseye o/s, which was fine.

To get the libraries and python program code, I followed 'Data 36' on YouTube (checkout data36.com).  You also get temperature in the output.

I have an LCD screen attached to this pi, so when I am outdoors with the pi running on a battery pack, I can see the info.  Neat! 



Next, I have to calibrate the sensor so I know what the moisture content value is in terms of percentage water to soil.  This may be soil type specific. The basic flow of data is between say 300 and 2000, just a number.

My neighbour 3D printed an enclosure/handle for the sensor to protect it.  Thanks!

By taking moist soil and air drying it over a number of days to constant weight, I could calibrate the sensor.  I measured the reading each day and then back calculated the moisture as % volume afterwards.  I also had a Theta probe to compare it with, which works well.

Dry sandy soil gave a sensor reading of 400, and wet soil 660.  But it was not a straight line: it changed slowly from 0 to 5% moisture (600 on the sensor) then soil moisture changed rapidly to 20% but the sensor only went to 660.  So the sensor is not very sensitive at the point where you want it to be!  But it could be used to say the soil is getting rather dry and hope your plants don't die.

The other problem is that the sensor is not waterproof so only measures the top of the soil and there may be moisture lower down in the pot/soil.

Sensor transferred to the Samosa project in December 2024.

Camera

I have a NoIR camera for the Raspberry pi 3B.  I had to install the Buster operating system  for it to work properly.  The camera has No IR filter (hence the name) so can see in the dark but only if I have a IR source of course.  I ordered one and received it. Cheap and limited range.

In the meantime, when the security light comes on from its PIR sensor, the camera records what's there.  Usually cats, although we have seen a fox before. Hoping for hedgehogs again one day.

I had to enable the camera option on the pi and enable motion following 'pimylifeup' instructions.  I can start and stop detection through the terminal window.  Image files are stored in /motion folder and I have a screen plus keyboard+mouse to view the files.  Ctl + A to select all files and right click to delete rather than putting them in trash, which accumulates.

I had an old gorilla tripod and I got the holder that goes with the camera to make a neat unit.  I also got the one metre ribbon so the pi does not have to be close to the camera.  

We think we have bats roosting so will try to catch them on camera when they start flying regularly later in the spring.


Old phone as a camera

An old mobile phone can be used as a camera.  Download the 'Ewelink camera' app on the old phone and 'Ewelink' app on your new one.  Create a free Ewelink account on their website and connect the two.  The old mobile now works as a remote camera.

Fibre to Home 

In December 2023, I changed Plusnet to 'fibre to the premises'. It was a quick and easy job by the Openreach engineers.  They drilled a hole from the outside box by the front door into the living room, where there was a mains plug close by.  With a 4-plug extension I could add various gadgets to the router like the MyEnergi Hub and the heating control hub.  I have a TP Link adaptor that connects upstairs to a 4 way ethernet adaptor and hence to my PC, as well as a range of devices such as Raspberry pi, laptop, etc.

Once re-paired most systems worked fine.  However, the Sonoff switches did not pair.  I had a new Sonoff SV 12 volt switch that requires 2.4 GHz connection.  The Plusnet Hub 2 is dual channel and this seems to interfere when 5 GHz is also available.  In the router settings (192.168.1.254) I stopped the 5GHz and changed to Mode 2 (as per internet suggestions) and this allowed, eventually, the pairing to proceed.  I could then reinstate 5gHz and Mode 1.

Pigeon scarer (January 2024)

As I have solar panels, pigeons (of course) want to nest under them.  I did not get netting when the panels were installed, so I am suffering from their incessant cooing.  I have tried waving my arms and shouting and throwing tennis balls at them.  Sort of works for a short time but they come back.  I had a plastic owl and CDs on a flagstick too (rather prone to being blown off the roof).  I tried spraying with a jet of water from a hose pipe and this looks promising, if only I could automate it. 

So I have rigged up a hose with a nozzle to rest securely on my gutter.  



The hose connects to an outside tap.  To control the water flow, I have bought a 12 volt solenoid valve (off until switched on) and a switch with wifi (Sonoff SV).  




This connects to my Home Assistant and hence my mobile phone.  So far so good, it all works.

Next, go up a ladder and join it all up. Done.  There is a enough water pressure to give a good jet.

So when I hear the pigeons, I can press the button on my phone and it will squirt water. 

I have also bought a PIR sensor and a Wemos D1 mini.  I hope that this will automate water flow when pigeons are detected. John T lent me a microwave motion sensor that will go through building materials (not metal, e.g. foil).

The D1 mini sits in a corner of a room and wires pass through a hole in the ceiling into the loft space. The D1 mini talks to Home Assistant via wifi.

The PIR sensor is on the roof outside connected to the same D1 mini.  It may be affected by sunlight making it fire off almost constantly?  Seems ok when its cloudy.  Is it affected by windy conditions, wobbling it? (PIR was later removed as unsuitable for outside on a roof).

The microwave sensor RCWL-0516 seems to work through the roof felt and tiles but it may be much less sensitive.  I may join three together to cover a bigger area of roof.

I have written an automation to sense when the microwave motion sensor triggers; it then switches on the hose for 5 seconds and waits for 2 minutes before being alert again (otherwise it may go off constantly, triggering itself!) 

A month or so later:  the water system all works automatically but the pigeons get used to it.  I put a large speaker into the loft just under the nesting point.  I connected it to an old amplifier which gets sounds fed from Home Assistant.  A big bang!  I used a single drum beat first, then added a hawk screech and also added a shotgun blast - they don't like that one!  

They are persistent though!  A sonic transmitter might work (£40).  It is coming today.  It might have been useful but in the end I gave in and paid for netting (autumn 2024).. 

Wemos D1 mini

Small processors with wifi.  I have attached a temperature/humidity sensor to one.  This lets me position it anywhere in the house e.g. garage and see the data.  I used ESPhome in Home Assistant to set it up.

A second D1 mini has a PIR sensor for the pigeon scarer (this works too but not set up yet) see above.

I got 5 of the D1 minis in the end, very useful.  One controls the pond fountain automatically via Home Assistant.





Comments

Popular posts from this blog

Vehicle tracker and boat sensor display (Project Samosa)

Doorbell notification to phone

Weather station