December 28, 2014

Arduino Weather Decoding

I have been working on making a nice OO interface with interrupt callbacks to the popular DecodeOOK (on-off-keying) class for Arduino. This is used to receive wireless data from various weather station sensors.

The changes make it easy to receive weather data in your project. You tell it what decoders you are using, and what sensors talk to those protocols, and then give it a callback to call when some weather data has been received.

The library handles all the interrupt stuff, and then determining which of your decoders and sensors can understand the data received. Your callback gets sent an object that can tell you what kind of data was received (temperature, humidity, wind direction etc) and what the values were.

Anyway, the library is called WeatherOrNot and code is on github at https://github.com/eb3nezer/WeatherOrNot

November 23, 2014

Weather

This is a picture of the internet part of our weather station.

After reading that it was possible to receive the signals sent by the wireless sensor for an Oregon Scientific weather station, I thought it was worth building a project to try this.

This picture is the result.

On the top you can see a 433MHz receiver "shield" that sits on top of an EtherTen Arduino clone. The actual receiver is the small green board on the right.

The software listens to transmissions from the weather station's outdoor sensor (for temperature and humidity) and periodically sends this data to Weather Underground.

Of course the normal Oregon Scientific indoor display continues to work.

The software ended up being the tricky part of this project. There is code available to both decode the transmissions, and upload them to WU. The tricky part was that I wanted to make a nice OO library out of the RF decoding code that you could easily use in other Arduino projects. The library is still a work-in-progress, but it is working well enough that we have been reliably sending data for the past week. I will write about the library again when it is ready to release.

For the current weather in Ashfield see my PWS page.

November 06, 2014

Fix for OpenELEC network issues


I love my OpenELEC media centre running on my Raspberry Pi, but lately I have been seeing a problem where the network does not connect when the device reboots. OpeneELEC is set to use DHCP, but the network interface just doesn't come up.

This is a bit of a problem, as the RPi does not have an internal clock, so it relies on the network to find out the time. Without the correct time none of the scheduled recordings start.

I thought it might have been some update gone bad. I have been manually starting the network every time the box reboots (fortunately not very often) for a while now, until I stumbled upon this bug report:

https://github.com/OpenELEC/OpenELEC.tv/issues/3457

The solution? Remove the files for the network connection manager, and reboot!

rm -rf /storage/.cache/connman/ && sync && reboot

September 14, 2014

JBlinky Build Instructions

JBlinky is a small night light project I designed for my son's birthday party sleepover. JBlinky has a light sensor and a temperature sensor. When it is dark, the NeoPixel strip lights up, with the colour depending on the surrounding temperature. The colour changes gradually as you make it warmer or colder.

Although I did the soldering myself, the rest of the construction was done by the boys.

In terms of a party activity, I think the weak point was the final step of putting the wires in the holes on the Arduino. I had multi-strand wires, which were a little too thin to grip well in the Arduino. Perhaps a thicker single core wire would have been better for the Arduino connections.

That said, the boys had fun, and all the JBlinkies worked as expected. Here are the build instructions, just in case you have been following this project, and you want to make one yourself.

If you make one, please leave a comment to let me know how it went!

Bill of materials:
  • Arduino Uno or compatible. We used some EtherTens, because I happened to have a few spare lying around. A mini version would also work fine. This project needs 2 analog inputs, and 1 digital output.
  • 4 x AA battery holder. You could use 3 x AA, although we used 4 so that you could run the project on rechargeable batteries.
  • Adafruit NeoPixels. We used 4 from a strip of 30/m. That suits the size pretty well. Using 6 from a strip of 60/m would also work well. If you use a different number, then the code would be slightly different.
  • LM60 temperature sensor.
  • Senba light sensor. (Substitute any LDR if you like)
  • 470 ohm resistor
  • 10k ohm resistor
  • 1k uF capaitor (optional - if you are not using battery power, then I recommend this, but in the end we didn't use it in our build)
Other things:
  • Hookup wire
  • Heatshrink tubing
  • Solder
  • Soldering iron
  • Some type of box. We used a clear takeaway food container.
  • Double sided tape
  • Wire strippers
  • Wire cutters

Batteries

If using 3 x AA alkaline batteries in a 4 battery holder, place a wire between the spring of the missing battery to the spring of the 3rd battery. The exact placement of this wire will depend on how your battery holder is made, but essentially you want it to go across where the 4th battery would normally go. I soldered the wire to the 4th spring, but then just placed it between the 3rd battery and 3rd spring when the 3rd battery was inserted. This allows one end of the wire to be removed latter if you want to replace the alkalines with NiMH batteries.

Stick the back of the Arduino to the battery box with double sided tape. Make sure you can still open the battery box, and that any on/off switch is not covered up.

NeoPixels

The Adafruit NeoPixels are a great product. They have a single digital connection to send data to the whole string. Use however many you like. For my project, 4 pixels from a 30/m strip worked out at just about the right length. Using more will make your batteries run down faster.

Due to the way the NeoPixels operate the data "in" connection must go at one end. There are labels to indicate which end this is. I put a 470 ohm resistor inline for the data line to provide a bit of protection (as suggested by Adafruit).

Solder one end of the resistor to the NeoPixel strip's data input pad, and solder a wire to the other end of the resistor. (I used orange here, which will match the orange in the diagrams.)

Solder a wire to both the V+ (red) and V- terminals (black). Trim off any extra wire.


If you are going to add the capacitor (probably don't bother if you are only using battery power) then solder this directly to the NeoPixel strip (electrolytic capacitors are polarised, so solder negative to negative, and positive to positive), and then solder the wires to the protruding leads of the capacitor.

Now put some heat shrink over the resistor to cover up any exposed metal wire. If you used the capacitor (like in the photo above) then also add some heat shrink to any exposed solder joins for the red and black wires.

Let me just say that the boys LOVED the heat shrink. We used a hair dryer to shrink it.

Temperature Sensor

I used a TI LM60 analog temperature sensor in a TO-92 form. The sensor outputs a voltage that is proportional to the temperature. This makes it easy to interface to an Arduino.

The LM60 has an effective temperature range from -40 to +125 degrees. This gives the boys the opportunity to see a change between the kitchen freezer (about -15 degrees) and the hair dryer. Note that the LM60 has an accuracy of +/- 2 degrees. For a thermometer this is not very accurate, but for this project it is perfect.

Solder a wire to the middle (output) pin. I used yellow, which corresponds to my diagrams. Check the data sheet to find out which are the positive and negative pins (positive is left, when the pins face down, and the flat side faces towards you), and solder wires to the positive and negative pins. Put some heat shrink over the solder joints to reduce the chance of a short circuit.

Light Sensor

To sense the light level I used a Senba LLS05-A. I used these mainly because my supplier had them in stock, and I didn't have much time to get the prototype going before the birthday party!



I'm going to connect it in a voltage divider type circuit, so really any LDR would do.

Solder wires to the Vin (red) and Vout (green) pins. (Check the data sheet to know which is which.) If you use an LDR then they are not polarised, so you can use either pin. As with the temperature sensor, add some heat shrink over each solder joint to prevent short circuits.

Rather than put the 10k resistor inline with the light sensor I opted to make a connecting wire with the resistor inline. As I am not using a breadboard or protoboard, this makes connections easier later.

Solder wires to either end of the 10k resistor. I used green for one end and black for the other. This is because the resistor will go between the output of the light sensor (green) and ground (black).
Now put some heat shrink over the resistor.

Connections

Strip the ends of all the wires. We are going to need to connect multiple wires to a single pin on the Arduino in a number of cases. The way I did this was to add one extra connecting wire of the corresponding colour, solder together all the remaining wire ends, and connect the other end of the connecting wire to the Arduino.

Red for +5V

We will need to connect together all the +5V connecting wires, and connect that to the +5V pin of the Arduino.

Cut one more small (ish) length of red wire and strip both ends. Connect together one end of the following 4 red wires:
  • The small red connecting wire you just cut
  • The +5V wire for the NeoPixels
  • The +5V wire for the temperature sensor
  • The +5V wire for the light sensor (or LDR)
I twisted the ends of the wires together, added a blob of solder, and then got the boys to put some heat shrink over the join.

Black for Ground

We will connect together all the Ground connecting wires, and connect that to the Ground pin of the Arduino.

Cut one more small (ish) length of black wire and strip both ends. Connect together one end of the following 4 black wires:
  • The small black connecting wire you just cut
  • The Ground wire for the NeoPixels
  • The Ground wire for the temperature sensor
  • The Ground wire for the 10k resistor assembly (the black end)
Join them together as per the red wires.

Green for the light sensor

Because we want to connect the output of the light sensor to ground, this would make 2 wires going to the analog in pin. I connected the wires before the pin in a similar way to +5V and ground.

Cut one more small (ish) length of green wire and strip both ends. Connect together one end of the following 3 green wires:
  • The small green connecting wire you just cut
  • The green wire coming out of the light sensor (or LDR)
  • The green wire for the 10k resistor assembly

Programming

Here is a link to the code: JBlinky.zip

I also used the following libraries:

Plugging in


Connect the black wire (the small one coming from the connections you just joined) to the GND pin of the Arduino.

Connect the red wire (the small one coming from the connections you just joined) to the +5V pin of the Arduino.

Connect the green wire (the small one coming from the connections you just joined) to the A1 (analog 1) pin of the Arduino. This is the output of the light sensor.

Connect the yellow wire to the A0 (analog 0) pin of the Arduino. This is the output of the temperature sensor.

Connect the orange wire (coming from the 470 ohm resistor on the NeoPixels) to D6 (digital 6) pin of the Arduino. The is the input for the NeoPixels.

Connect the black wire coming from the battery box to the other GND pin, and connect the red wire coming from the battery box to the Vin pin.

Testing

The power on sequence shows a short rainbow pattern (from the Adafruit NeoPixel library test code). If you see the rainbow pattern when you switch on then you know the NeoPixels are connected correctly.

Placing the light sensor in darkness should make all the NeoPixels light up the same colour. This lets you know that the temperature sensor is connected correctly.

Once you know that the light sensor is working, with the lights on, touch the temperature sensor with your finger to warm it up. As it warms up the colour of the NeoPixels will change slightly. This lets you know that the temperature sensor is connected correctly.

If your testers have a torch/flashlight then perhaps they can use it to discover the Easter Egg mode...


Schematic

For completeness. Note that this shows the light sensor as an LDR, and it shows the LM60 as an LM36.



September 12, 2014

Ready to go

OK it is later in the evening than I would have liked, but all the parts are finished, the instruction booklet is written, the Arduinos are programmed, the containers have sensor holes drilled, and all the parts are in ziplock bags.

September 11, 2014

Fritzing

Yesterday I discovered Fritzing. It is quite a useful tool for making an assembly diagram (along with a circuit diagram).

September 10, 2014

Play Time


I modified the programming last night to make even small changes in temperature cause slight changes in colour. We had a lot of fun seeing what colour we could get from the freezer.



September 08, 2014

Sneak Peek

"So Ben, what are you actually making?"

The plan is to make a temperature and light sensitive blinky thing. You can see my assembled prototype above. When it gets dark the lights come on, and do different things depending on the temperature.

The core of the project is an Arduino (compatible) micro-controller. On the side it has 4 digitally controlled multi-colour lights (Adafruit NeoPixels). On the other side it has the light sensor and temperature sensor. The batter box is under the micro-controller.

I have pre-done most of the soldering (just finished in fact). The party-goers will need to add some heat shrink, get me to solder a couple more wires, connect the wiring to the correct ports on the Arduino, and assemble the rest.

Just the thing for a fun sleep over.

September 05, 2014

Project Cases


Thanks to Hokka Hokka in Westfield Sydney for helping out.

September 03, 2014

Soldering and testing

First up is the NeoPixel strip. AdaFruit suggest a 1000uF capacitor across the power lines, and a 300-500 ohm resistor for the data line.

The solder pads for the NeoPixel strip are pretty small. I ended up soldering the capacitor to the strip, and then soldering the red and black wires to the capacitor leads. I soldered a 470 ohm resistor to the data pad, and then soldered the orange wire to the resistor. In the photos the resistor is covered by heat shrink. The different colours of hookup wire came in handy!



Red to +5V, black to GND, and orange to digital 6. I uploaded the test code for NeoPixels, and plugged in a battery. Wow pretty colours!

Now for the temperature sensor. The Texas Instruments LM60 reports a voltage proportional to the temperature. The temperature in degrees Celsius is the output voltage minus 0.424V divided by 0.00625. It is not hugely accurate, but it does the job.


In the photos you can see hookup wire soldered to the leads of the LM60. Red to V+, black to GND, and yellow to Vout (which goes to analog pin 0 on the Arduino).

I wrote a simple program using the above formula that displays the current temperature to the serial console. It says 17 degrees in here. My thermometer thinks about 16, so for +/- 2 degrees, that's OK by my books.

Next comes the light sensor testing. I hooked this up yesterday before I had pretty coloured wire, so now of course I have to refer back to the data sheet every time I connect it.

It connects to +5V and analog pin 1 on the Arduino. There is a 100k resistor between analog pin 1 and GND.

It's a bit dim in this room, but it is light enough to see. Even so, the values I am seeing from my test program are a bit low. On the Arduino, analog pins report a value between 0 and 1023. For the light sensor 0 means really dark, and 1023 means bright light. I'm seeing values of about 10. It does get higher if I face it towards the light, but it's still a bit low for my liking. Oh well I guess I'll have to work with that.

Delivery 2

The order from Element14 is in! I am ready to start construction of the prototype.

(I added some hookup wire of different colours, and some double sided tape.)

Power and Light

 
So, 3 batteries or 4? The neopixels specify 6V max, so 4xAA is a bit risky. Nominally AA cells are 1.5V, but new ones can be a little more. To be safe I used 3, and added a wire where the 4th battery would go. Multimeter says 4.8V. Perfect.

You can see also where I have attached leads to a light sensor. I put heat shrink over the joins. I can't test it yet as I am still waiting for my resistors in Delivery 2.

Connect the battery box to an EtherTen pre-loaded with the blink sketch, and flip the switch. Perfect!

I can't wait for the rest of the parts.

September 02, 2014

Delivery 1

The NeoPixel strip and light sensors arrived today from Core Electronics.

September 01, 2014

It Begins

Battery holders, batteries, and the NeoPixel Uberguide

The plan is to build "some kind of night light blinky thing" with 6 boys. So far the parts list includes:
  • Arduino compatible microcontroller
  • Light sensor
  • Temperature sensor
  • 4 x Adafruit NeoPixels in a strip
  • Battery compartment
  • Various other ... bits
I already have the Arduinos (somewhere...), and I bought the battery holders and batteries today. The rest is on order.

Hopefully I can put together a prototype this week.

Updates as they become available.

February 24, 2014

Online calendars

I have been getting organised with online calendars.

I asked some colleagues at work if any community organisations they were involved in used subscrib-able calendars. A number said yes, so I looked into setting it up for a few organisations I deal with, as none of them use one.

Essentially I set up a new calendar with Google Calendar and then copied the public URL for that calendar. People use the URL to subscribe in their calendar program. Then I made a simple web page for each. Google Calendar provides a way to embed a calendar in an iframe so you can see a sample.

Some organisations I made a calendar for will probably make their own one day, but for now people can share mine. You can see a few at http://users.on.net/~bhkelley/calendar.html