Category Archives: Parts

Anemometer coding woes

Turns out all my anemometer code so far is wrong, equations is not my strong suit and I seemed to be always trying to overwork the equation.

The above is mostly the code I am using now. I have tweaked it since to allow float seconds so I can use the same procedure to work out the gusting speed.

The above code is borrowed from Sparkfuns Weather Station Tutorial.

Arduino Uno to the rescue

Basically I was having all types of trouble trying to get the sensors working on the Pi, different versions of python (mainly due to library limitations) and probably just poor coding. The Lux sensor was the biggest headache, the returning values were all over the place.

So I decided to try the Arduino Uno, since most of the Adafruit tutorials use a Uno to get them working and it uses C programming language, which is a lot less annoying than python. Basically in the space of the weekend I have all four sensors working and even have the interrupt programming done for the rain sensor.

2014-05-04 12.43.15I also order the UV sensor from Pimoroni, which simply returns values for the UV index, which is something I also wanted to capture data for, to see if the index is slightly raising, which might be a sign of global warming/ozone depletion.

SI1145The SI1145 can also read visible light and IR but those returning values are not calibrated, so I am not going to bother with those.

Although I have found out that my RGB Leds that I have are around the wrong way, the common anode needs to be positive and not neutral, so ebay to the rescue again.

Got a little more work to do with code, then I can figure out how to get the Pi talking to the Uno and get the values posted to the web, so I can start getting that sorted.

Nwazet Case Tyler Issues

I did post a product review to for the Nwazet Tyler case, but for some unknown reason it’s not been posted. I definitely think people should be aware of a few issues with the case.

1. No Manual

There is only the online manual and its a bit vague about which screws to use in which part. You do have to be careful as the threads are different on some of the screws. Plus some of the critical shots on the website of the screws are blurred making it difficult to identify the correct screws.

2. Foot Piece Broke

The feet is made up of two pieces that fit into each other making a cross, but the machining was a touch tight and when pushing the pieces together, one side broke into two pieces. Luckily I was able to use a plastic bonding solution to repair the piece and then file away some of the plastic, so as to make it fit together without breaking again.

3. Product Shots are not accurate

The Tyler case is supplied with a clear red insert to sit behind the face and red LED’s. It is mentioned in the product description on modmypi, but the pictures are misleading. The finished article will look quite different to the product shots. Nwazet allows you to set the colour when buying, but modmypi doesn’t offer the colour combinations.

Since I will be using multi-colour LED’s, I will have to source another piece of perspex that is opaque white. It does seem a little weird that such a happy case is supplied with red face bits and not a more neutral/happy colour scheme.



It’s not really a case a child could put together because of the lack of a manual. Other than the issues mentioned here, it’s a nice case and only having the base constructed makes for a nice bed to work around whilst I sort out my wiring and code. Scored: 3 out of 5.

I will update the article when I’ve finished my case and post some pictures.

Wind Sensor Testing

UPDATE2: yeah ignore the drivel in this post and check this post for correct equation for the anemometer.

UPDATE: So it turns out that I haven’t a clue about how you measure wind speed with an anemometer. I found the datasheet for the sensors, which gives 1.492mph per pulse on the anemometer over 1 second, so I have had to rework the equation and procedure below. So the screen shot below gives wrong values, but is an example of the scripts output.

Just started testing with the Anemometer N96FY. I have the anemometer connected to GPIO pin 18 and 3.3 volt supply. This wind sensor is like a switch and it’s default state is closed, meaning electricity with flow through the anemometer except for two opposing points during a full revolution where the voltage will briefly fall to zero.

I work out the equation to be

wind speed = half the circumference / time taken

Wind speed will be in metre per second. Half the circumference is 0.21994 metres.



Parts Ordered

I have finally ordered the parts I wanted. ModMyPi was cheapest for most of the parts, some of the parts were sourced from Pimoroni, who have already shipped my order.

The Micro SD card and adapter, I sourced from Amazon. Decided to go for 32gb card (MB-MPBGCAEU), so the database can expand as much as it likes. Incidently, I read somewhere and for the life of me, I can’t find the article about the NOOBS card from the RP Foundation. That Samsung cards offer the best random access figures, hence why I have opted for the Samsung card, hopefully it will work. It looks awfully like the card that ModMyPi sells.

I do want one of these keyrings.

Anemometer N96FY

I have purchased the N96FY Anemometer from Maplin Ebay store for the tiny price of £2.49 +delivery (£3). You can purchase then through the main Maplin web site if you don’t want to go via Ebay.

It rotates very easily and seems extremely sensitive to even the slightest breeze. The anemometer has two reed switches in the unit, both pulse during 1 revolution. There is only 2 wires coming from the unit, so you can’t sense the reed switches separately. The radius is 70mm measured from the centre of the spindle to the centre point of the cup. A nice round number to work with. As a side note the mounting piece at the bottom is 18.5mm diameter (outside measurement).


Working out the circumference

The equation is C = 2πr. I take pi(π) as 3.142 and convert radius(r) to metres, because I want to measure my wind speed in metres per second. So radius(r) becomes 0.07 metres. Therefore:-

0.43988 (circumference m) = 2 x 3.142 (pi π) x 0.07 (radius r)

So we can round this to 0.44 metres for the circumference. So 2.72 revolutions per 1 metre per second of wind speed. Which is just over 4.54 reed pulses.

Conversion to other measurements

So it turns out the official unit of wind speed is the Knot (who knew?). I am not terribly bothered about measuring in Knots, since it’s a unit that has little meaning to me, but the Knot wikipedia entry does provide conversion to other units of wind speed.


 So conversion to other units is pretty simple, just a matter of applying a multiplier, which should be easy enough in the php code.