John's Blog

July 1, 2009

Energy tracking

Filed under: Arduino — john @ 4:19 pm

Purchased a Current Cost CC128 meter and it arrived yesterday. No problem getting it going and it is now connected to an Arduino with a XPORT Ethernet shield. I got NewSoftSerial reading from the CC128 at 57600 baud and controlling the XPORT at 19200 baud. I am logging the temperature and watts usage to Pachube every 30 seconds.
Last 24 hours temperature
Last 24 hours electricity useage

June 28, 2009

Schmap and Barry Island

Filed under: Photo a day — john @ 11:11 am

I got a photo published! Schmap have included one of my Barry Island pictures on their interactive guide.
Barry Island

June 19, 2009

Capacitance meter (1)

Filed under: Arduino — john @ 11:02 pm

Whilst I was looking at the ATmega168 datasheet to see if I could improve the NewSoftSerial library speed I came across the analog comparator – this takes a reference voltage at digital input 7 and a voltage to be compared at digital input 6. Any time the voltages are equal (rising or falling – you choose) you can get an interrupt. Even better it will trigger a snapshot of Timer 1 (a 16 bit timer/counter), the spec calls this a Capture.
I started thinking about a capacitance meter using this.
Capacitors charge up with a time constant of T=RC, by measuring the time to charge to 63.2% of the supply voltage and knowing R we can caluate C. This has been used before to produce an Arduino Capacitance Meter. The span and accuracy of such meters has been limited by how accurately they can measure the time. Using the Analog Comparator and Timer 1 should enable me to get a much more accurate measure. Using a prescalar the input to Timer1 can be 16Mhz, 2Mhz, 250Khz, 62.5KHz or 15625Hz – on a 16bit counter this gives a large number of possible ranges.
I decided to go with 4 ranges (based upon a minimum count of 30 and a maximum count of 60000 – to get enough resolution and not get too close to overflow).
R=2M2 Timer1=16Mhz Range 0.8pF – 1.7nF
R=2M2 Timer1=62.5Khz Range 218pF – 436nF
R=1K Timer1=250MHz Range 120nF – 240uF
R=1K Timer1=15625Hz Rage 1.9uF – 3840uF
The meter will be auto ranging – I will use the Timer 1 Capture interrupt and the Timer 1 Overflow interrupt. I have built a proof of concept and it all seems OK so I will be building the meter over the next few weeks (as I get time).

June 15, 2009

Arduino Ethernet

Filed under: Arduino — john @ 8:47 am

I have been playing with ethernet for the Arduino – I got hold of a Nuelectronics EtherShield and started to make it work. The examples were badly formatted and difficult to read but I learnt a lot of TCPIP and got it working fine. The issue here is that as you are down at the TCPIP layer there is a lot of code to manage and you are limited to quite small packets (as the Arduino does not have a lot of RAM). However this is a great larning tool for Ethernet protocols.
So my next step was to look around for something that could do more – I came across the LadyAda Ethernet Shield kit and decided to get this and a XPORT ethernet module. I’ve put these all together and I can now communicate with larger packets – I tried the provided “Read from Twitter” example, after altering it to match the current Twitter formats it worked fine. I wasn’t receiving the whole page but around 11 Kbytes is not bad (compared to around 500 bytes for the EtherShield). It uses a library called NewSoftSerial, a great improvement over the the one provided in the Arduino kit; it uses interrupts to get the data. I couldn’t get consistant performance over 19200 baud so I am looking forward to a release that properly implements RTS/CTS then we should be able to run comfortably at 57600 baud.

June 12, 2009

ByVac I2C LCD controller

Filed under: Arduino — john @ 7:33 pm

I got the ByVac BV4208 working, the library is here.
To use include the library “Wire” and then “ByVacLCD” (I don’t know why you have to include “Wire” even though the library already includes it but you do – I spent ages on this one). Note as this is I2C it uses analog inputs 4 and 5.

#include <Wire .h>
#include <ByVacLCD .h>
// declare the object – address in the data sheet is 0×42 but you
// need to divide this by two to get the ‘normal’ 7 bit I2C address
// – the low order bit is added on by Wire.
// this declaration is for 4 rows of 20 characters.
ByVacLCD bv = ByVacLCD(0×21,4,20);

void setup()
{
bv.init();
bv.print(”Hello World”);
}

void loop()
{
bv.setCursor(1,0);
bv.print(millis());
}

June 11, 2009

Arduino LCD test

Filed under: Arduino, Photo a day — john @ 5:35 pm

I got hold of a I2C Real Time Clock module and a two line LCD display. Managed to get them both connected and working.
Arduino with LCD
I am now working on adapting the display to I2C using a ByVac BV4208.
I have written the code and tested on a breadboard using a Roboduino nano (same as an Arduino Nano) – now to build the veroboard version.
I destroyed the Schottky diode on my nano when a loose wire shorted out 5v to ground and the USB supply overloaded. It all still works but will not power from the USB anymore.

June 4, 2009

Arduino interface to TMB880CF

Filed under: Arduino — Tags: , , — john @ 7:15 pm

I found an old LCD thermometer – got it from Maplin many years ago. I hunted for specs on the web but all I could find was that it used a serial data stream. It runs from 1.5V so I used an NPN transistor and a schmitt trigger NAND gate (old 74LS132 chip I had) to interface through to 5V (note to self – I need to find a program to draw my circuit diagrams so I can publish them). I used interrupts on the falling clock pulse to get the data. The Arduino code is here.

From Richard Norman on forums.parallax.com
The thermometer device measures the temperature every 10 Seconds and outputs
the data as serial data as 13 pulses on two pins as follows:
Thermometer Pin 9 (Data out):
Thermometer Pin 10 (Clock Pulses Out):
With the exception of the first clock pulse (which has a duration of 1mSec),
the clock pulses occur 0.125 mSec after the start of the data pulse and last
for 0.125 mSec.
The data bits have the following significance:
D01 – Degrees Celcius Polarity
D02 – 80
D03 – 40
D04 – 20
D05 – 10
D06 – 8
D07 – 4
D08 – 2
D09 – 1
D10 – 0.8
D11 – 0.4
D12 – 0.2
D13 – 0.1

June 3, 2009

Arduinio

Filed under: Arduino — Tags: — john @ 12:53 pm

I heard about the Arduino on the BBC website recently (story) and have been playing with it. It appears to be exactly what I was looking for about ten years ago!. I’ll post here as I achieve anything.

May 20, 2009

Chelsea Flower Show 2009

Filed under: Photo a day — john @ 8:27 pm

Our trip to the Chelsea Flower Show is on Wilbeary’s blog.

April 15, 2009

Fox in the garden

Filed under: Photo a day — john @ 9:12 pm

Imagine my surprise when I looked out of the back window earlier today
P4152051

Older Posts »

Powered by WordPress