Thursday, June 10, 2010

Home Monitoring System – Electricity Monitoring

My latest activity is a home monitoring system. My starting point is electricity usage. Once I have that up and running I plan to expand into other areas.

After spending some time with Google I found a number of both commercial products and opensource solutions. All of them appear to be based on one of two approaches.

The first approach is to use a current transducer which is installed on the feeder cables for the main electrical panel. The second approach, and the one I have chosen for now, is to setup a sensor to read the electric meter.

I my case I have an electric meter that has a spinning disk. The disk has a black stripe on it. I have rigged a high intensity LED that shines on the disk and am using a photo resistor that measures the reflection from the LED off the spinning disk. The photo resistor is connected to an analog pin on an Arduino. Every time the black stripe passes in front of the photo resistor the resistance increases and the resulting voltage on the analog pin decreases.

One challenge I faced was that no matter how well I covered the meter while still allowing it to be read I was not able to get it to the point where the changing ambient light during the day and night didn’t affect the baseline. The way I solved the problem was to average the last 500 readings as the baseline. The allows the baseline to move up and down and I determine a rotation has occurred by looking for a delta.

Below is the whole setup with the front cover removed.

image

This is a blow up of the actual sensor. I used a block of wood with two holes drilled in it. One hole has the LED in it and the other the photo resistor.

image

Here is what the setup looks like with the front cover on it. The open slot at the top allows the dials to be read. I am hoping that the electric company will agree with this the next time they come around to read the meter.

image

For now the wires go through the wall and are terminated on a Boarduino from Adafruit which is connected to a laptop via a FTDI USB Board from Sparkfun.

The next step will be to add local storage to the micro processor and a wireless link to allow the data to be read from a monitoring system.

More to come…

Wednesday, June 9, 2010

Bicycle Trainer

Well I haven’t been doing a good job of posting  what I have been up to.  Here is an installment about my work to create an interactive bicycle trainer.  The work was done during the winter of 2009/2010.

Back in March I posted that I had been working to make my winter time bicycle training more interesting.  During the past winter I worked up three different sensors to interface my bicycle to an Arduino.  The data that is captured by the Arduino is sent to my PC via the USB connection and fed into a program written using openFrameworks that runs on the PC and provide graphic feedback.

For anyone who doesn’t know “openFrameworks is an open source C++ toolkit for creative coding.”  It has a number of excellent examples to get you started and also has a number of routines to interface with the Arduino.  I strongly suggest that anyone interested in interfacing the Arduino with a PC that has programming experience take a look at it.

 image

As you can see in the above screen shot the program displays the time I have been riding, the miles per hour, the cadence and the number of miles ridden.  Surrounding this information is a track with a red dot that is updated as I ride.

image

Here is the first sensor I wired up.  This was built using an old Cateye bicycle computer sensor which picks up rotations of the wheel and pedal strokes using sensors mounted on the frame and magnets on the wheel and pedal.

This should have been a simple build but turned out to be a real challenge.  I was riding on a set of rollers on a piece of plywood to protect the carpet.  The sensor would feed data to the Arduino for a while but then the Arduino would start giving crazy readings, locking up and rebooting.

To make a long story short it appears that the band that connects the front roller with the back roller was generating static electricity rubbing on the plywood.  This setup would run for a while as I was holding on to the wall to get started which must have been gounding the whole setup.  I solved the problem by placing an antistatic mat between the rollers and the plywood.

image 

The second setup was built with a set of infrared LEDs.  The transmitter and the receiver are mounted to a plastic U I fabricated and then a black plastic strip mounted to the counter balance breaks the beam which is connected to an interrupt on the Arduino.  This setup doesn’t support cadence.

image

The final rig I built was using a hall effect sensor and magnet from adafruit.  The sensor is connected to the bike frame using velcro and the magnet is connected to a spoke using a bolt that has been cut down the middle.  This setup also doesn’t support cadence.

All three of the sensor setups worked well.  By the time I had complete the initial experiments with sensors and got the openFrameworks program setup it was time that I could start riding outside again.

I plan to pick this project back up again this coming winter when I move my riding back inside.

Sunday, March 7, 2010

Network Caller ID Broadcaster and Receiver

As I mentioned in an earlier post back in December I had FIOS installed. One of the benefits of this was that my telephone service was upgraded to include caller id. While our cordless telephones were all caller id capable there is not a telephone located by every PC in our house and when not in use the telephones normally sit in their charging cradles. This got me started on a project to broadcast caller id across our home network so that we could determine who was calling before we got up to get the phone.

As with many projects the start of this one found me sitting at my computer running Google searches to see what others had done in this area. I found several but couldn’t get any to work with the modem sitting in my PC. This led me down the path of developing my own.

I had run across Qt a while ago and had wanted to do a project to try it out. For anyone who doesn’t know what Qt is it is a “Qt is a cross-platform application and UI framework” for c++. Qt had recently come under the control of Nokia after Nokia had purchased Trolltech which originally developed the library. One notable result of the acquisition were changes to Qt Licensing which is now available under Commercial, LGPL and GPL licenses. Qt comes with it’s own IDE Qt Creator as well as an extensive number of examples.

My project consists of a Windows Service that monitors a Conexant D850 modem in my Dell PC running Windows 7. The modem is monitored by a Windows service that reads the caller id information and then broadcasts it across the network. All of the PCs in my house are running a client that picks up the broadcast and generates a tool tray icon message.

While I have over 30 years of experience working and tinkering with computers my c++ experience is just slightly above basic level. Even at that level the Qt framework was very easy to use and within a couple of evenings and weekend afternoon or two I had the project to the point where it could be deployed.

The biggest problem I had was that in the middle of developing the software I replaced the PC I was using and found that after transferring the modem I was not receiving caller id. After much troubleshooting I found out that I needed to downgrade the driver. For anyone running a Coexant D850 PCI V.92 Modem if you want Caller ID information be sure and use version 7.74.0.0 dated 5/27/2008.

At this time I haven't come up with any place to post the code but if you are interested in a copy let me know in the comments section and I will be happy to provide it to you.

Tuesday, March 2, 2010

Time Flies – January and February 2010

Wow, my last post was back in December.

Since my last post I have worked on the projects below. I will try and get some details posted.

1) Program in c++ to read Caller ID off the modem in my PC and broadcast it to a client that is now installed on all PCs in the house. That way if you are on a PC when the phone rings you can see who is calling.

2) Started putting together a PVR using an old Windows XP PC and a Hauppauge card. I tried various open source packages but for now am using the WinTV package that came with the card.

3) To beat the winter blues of having to ride inside I worked at interfacing my bicycle to an Ardunio. I used an old Cat-Eye rear wheel and cadence sensor and I have it to the point where it is doing MPH and cadence back to the Arduino IDE.

Sunday, December 13, 2009

Quick Note – Windows Serial Port Enumeration

I am working to develop a serial port application on Windows. As part of this project I ended up wanting to code a routine to present a list of active serial ports on a PC.

What I thought would be an easy tasked turned into an evenings worth of work…

It turns out that there are a number of different ways to pull serial port information from a PC and they don’t all come up with the same set of ports.

The list of ports in some cases includes ports that are defined but not active or in some cases doesn’t include serial ports assigned to devices like modems. What a mess.

If anyone finds there way to this posting I wanted to give them a pointer to a site that helped me out a great deal. Check out Naughter Software’s EnumSerialPorts the shows 9 different ways to enumerate serial ports.

Thanks to PJ Naughter for putting this together and making it available to the rest of us.

It Worked for Me – FIOS Installation

We recently moved from Comcast to FIOS. The change was sparked by recent changes in Comcast’s cable service. We had been a long time Comcast customer and had a very good experience. However, when I compared bundled offerings from Comcast and Verizon the FIOS bundle came out better.

The week before Thanksgiving I put in a FIOS order and scheduled the installation for the next week. The day before the installation Verizon called to confirm that we would be home during the appointed window. The morning of the installation the Verizon Installer called to let us know that he would be arriving towards the middle of the installation window.

When the installer arrived we reviewed the setup. We looked at where the phone lines came into the house, the cable TV and found an appropriate power outlet that would be able to supply power to the box on the outside of the house.

It was an aerial delivery so shortly after we finished with the review another Verizon person showed up with a bucket truck and between the two Verizon personnel they installed the fiber to the house.

Overall the installation took four or five hours. The installer was very professional and even went to the trouble of having shoe covers for the inside work.

We now have a new box on the outside of the house, two phone lines moved over, three TVs connected and a new wireless Internet firewall/router. With one minor exception all parts of the installation went without a hitch. There was a problem with features on the two telephone lines which were reversed. A follow up email to customer service fixed this within 24 hours.

Two weeks after the install the TV service has been working flawlessly as has the Internet. One of the phone lines still has a problem with call forwarding.

Customizing the setup of the TV remotes and the Internet was easy to do. The Internet firewall/router even has a few bells and whistles that my previous Linksys and DLink boxes did not.

All in all a very good experience…

Time Flies – November 2009

Wow, looking back at my last post I see it was in October. November just flew by. Look for a couple of posts on activities that were squeezed in with everything else:

  • FIOS Migration
  • Garman GPS MAP 60 Acquisition
  • Hacking around with Qt
  • Arduino Robotics