Tuesday, November 29, 2011

Getting more life out of a 1997 Niterider Digital Head Trip

Now that I've gotten into electric RC airplanes, I have plenty of decent LIPO batteries and their assorted chargers around. This greatly simplifies making a LED bike light- now I just need the light itself, and the associated electronics to drive the light. I'd like to break this project into two components:

1) Build a device to allow me to drive my existing old-school 6V Niterider digital head trip lights off of 7.4V and 11.1V LIPO batteries. This will include a voltage regulator and a low voltage cutoff to prevent the LIPOs from being over-discharged and damaging the batteries.
2) Source appropriate LED lighting system to drive with the LIPOs.

So, my old Niterider is a 6V model, with maximum 15 watt power usage. (from my memory of the advertisements, not actual measurements)

Using P=V^2/R, and V=IR:

R = .42 ohms
I = 2.4A

A possible method to both regulate the voltage and protect the battery packs would be to use a UBEC. Hobbyking has one potential model: http://www.hobbyking.com/hobbycity/store/uh_viewItem.asp?idproduct=2160. This product can output either 5.0v or 6.2v depending upon jumper setting, plus it is capable of 4A current draw and has a low voltage warning buzzer. And it only costs $11.25.


This seems like a good solution to me. Cheap, easy and simple! 

As part of an order from Hobbyking for some RC airplane parts, I added a UBEC to try with my existing bike lights. I ended up ordering a different unit than I specified in the previous post- I went with this one instead: TR-UBEC15. It was a couple more dollars, but it has a much higher current capacity as well as being in stock.



Converting the UBEC to power the Niterider Digital head trip was easy- but ultimately unsuccessful.

Step 1: Cut off stock connectors off of UBEC and solder on EC3 (to connect with my LIPO batteries)




Step 2: Cut open old, worn out Niterider NIMH battery pack to recover the cord:



Step 3: Solder the NiteRider power cable to the UBEC output. 

The NiteRider plug is a "N" style plug, available at your neighborhood RadioShack. It's also center positive. In my cable, the white wire was the center positive, and the black was the outside ground. The red wire was unused. The colors may vary, so be sure to use a voltmeter to double check which lead is correct.








When everything was soldered and insulated with heat shrink- I did a quick short check then fired it up. It worked just fine- unfortunately the UBEC didn't deliver 6V- it was closer to 5.8V. The NiteRider Digital head unit didn't like that, and registered it as a flat battery and went into the low power "limp home" mode.

Bummer. Next time I place a Hobbyking order I'll try another UBEC, and hopefully I can find one with a specified higher voltage output. This might be a good option- 7.2V output- will overdrive the bulb slightly but should avoid triggering the head unit low voltage error. 

FYI, I finally ordered and soldered together the new UBEC (which works). See the post HERE.

In the mean time, I made a simple charge adapter to allow my RC battery charger to charge my old NiHM NiteRider batteries. It just a Type N power socket (from RadioShack) connected to an EC3 connector.


It works great. The big advantage is that the charger is programmable- so I can have it run multiple discharge-charge cycles automatically to cycle the battery pack. This is particularly important since the packs have been sitting around half-discharged for the last year or so.

Monday, November 21, 2011

Lake Level Sensor- Success!


I was able to get the lake sensor system to successfully push data to google docs: LINK



The “lakelevel” is the distance in inches from the sensor to the lake surface. I need to change this to lake height above sea level in feet and inches. I also need to add some sort of smoothing function to remove ripples and waves from the output. The water temp is in degrees F. (not working correctly at the moment) The photocell is relative sky brightness- 0 is no light, 1000+ is full sunlight. Air temp is in degrees F, and air RH is relative humidity.

I’m having some sort of hardware issue with the lake temperature probe- you’ll notice the anomalous reading in that column. Right now it’s sending data to google docs every 10 minutes. Once I figure out the water temperature probe, I’m going to add some data visualization -graphs over time + a graphical current status icon - then attempt to send those to the Mooney lake association website.

Also, the current code is a resource hog on the host PC. I need to dramatically reduce CPU use and then export the application as a stand-alone executable. Right now it's running from the Processing development environment. 

It's been a very interesting project- a great excuse to dive a bit deeper into hobby electronics and programming. 

Monday, November 7, 2011

Lake Sensor Project: Software

I'll admit that my software experience is pretty limited- mostly some classes way back in college. Not that this sensor package is anything terribly complicated by any standard, but it's been a nice learning experience. It's also been challenging, especially with a new crying baby and lack of sleep making concentrating on a new subject difficult!

So, at the moment the sensor package is transmitting data just fine. Originally I wanted the sensor package to transmit a packet of data only when requested. This worked fine when I had the PC and the Arduino directly connected via a USB cable, but this didn't seem to work with an XBee wireless module sending the data through the ether. I'm sure this is an easy problem to solve, but my limited web surfing didn't track down an obvious solution. To work around this I decided to have the sensor package continuously transmit data, at least for now.


The picture above is the raw data being fed into my laptop, after been wirelessly sent from the lake sensor to the XBee module. As you can see, it's just a list of numbers currently, delimited by commas. Here is what they are:

ultrasonic sensor, ping time to lake surface and back in milliseconds,  water temperature in degrees C (obviously not right, something needs to be fixed there), photocell resistance (lower numbers = darker), air temp in degrees C, relative humidity.

The next steps are:
  1. write some code to import this data into a usable form (probably using the free language Processing). Make Magazine seems to have a great tutorial on this.
  2. convert data into proper form- millisecond ping data into lake level in feet above sea level, temps converted into degrees F, etc.
  3. send the data into a google docs spreadsheet
  4. send to Mooney Lake association website

Saturday, November 5, 2011

Lake Sensor Project: Hardware Construction

Bare PVC Electrical Box





Drilling holes for ultrasonic distance sensor

Ultrasonic sensor, DHT22, and plug for thermistor installed:



All sensors are fixed in place and holes sealed with hot glue. The box should be essentially water tight.

Sensors wired to external daughterboard (for mounting pull up, pull down resistors for various sensors)

Daughterboard connected to XBEE shield via ribbon cables

Boards installed in box w/ self adhesive velcro. 


The hardware is essentially done. Eventually I'd like to set up a battery and solar powered system. Having an extension cord run down the hill to the dock is a little kludgy. Ideally I'd use some old RC airplane lithium polymer batteries that can't supply enough current to fly aircraft well any more, but would still work fine for this application. However, LIPO batteries need specialized charging circuitry that would require more research than I have time for right now.



Lake Sensor Project: Bill of Materials

Hardware top level description:

This project consists of two main hardware assembles:
1) Sensor package attached to dock with wireless data transmission
2) Wireless data receiver module attached to PC

I used the Arduino because I had one on hand. This particular model isn't manufactured any longer, but any of the newer models should work fine.

There are all kinds of rube-goldberg ways to measure lake level. I felt an ultrasonic distance sensor would be a good way to measure the lake level with no mechanical complexity. They are also fairly cheap, particularly off of Ebay. The HC-SR04 didn't have great examples online on how to implement the code, but I used some code examples off of Adafruit's excellent website and modified them for the 4-pin HC-SR04 vs. the models Adafruit carries.

The other sensors are pretty self-explanatory, I chose them for a nice balance of price vs. accuracy.

I had a hard time deciding whether to go with wireless data transmission, or wired. There are several ethernet options available for arduino boards, some of which even support power over ethernet (POE). POE would be particularly cool, since then I wouldn't have to run separate power and data lines down to the dock. POE vs. XBEE data transmission were about the same price. The decision point for me was lightning risk- running an ethernet cable down to the dock would expose my home network to a might higher risk of damage from nearby lightning strikes.

The enclosure is off the shelf electrical components from Lowe's.

Sensor Package Bill of Materials:

Item P/N Source Quantity
Arduino Duemilanove N/A www.adafruit.com 1
Ultrasonic distance sensor HC-SR04 www.ebay.com 1
Precision Epoxy Thermistor N/A www.adafruit.com 1
Air Temperature / Humidity Sensor DHT22 www.adafruit.com 1
Photocell N/A www.adafruit.com 1
X-Bee Shield WRL-09976 www.sparkfun.com 1
X-Bee Pro, Series 1 wireless data module (100mW power) XBP24-AWI-001-ND www.digikey.com 1
Printed Circuit Board, general purpose 276-150 Radio Shack 1
6"x6"x4" PVC outdoor wiring box N/A Lowe's 1
Redodot wet locations hinged outlet cover N/A Lowe's 1

Note: many misc. components were not included- headers to solder on to X-Bee Shield, ribbon cables, connectors, etc.


Wireless Data Receiver Bill of Materials:

Item P/N Source Quantity
X-Bee Pro, Series 1 wireless data module (100mW power) XBP24-AWI-001-ND www.digikey.com 1
X-Bee Explorer USB WRL-08687 www.sparkfun.com 1

Initially this data receiver will be used bare, but eventually it should be placed in an enclosure and placed somewhere safe and out of the way.

Lake Sensor Project - Sensor Package Installed!

It's been a while since my last post. We've been very busy with the new baby. Every once in a while I've been able to sneak off and work on my new project- a sensor package to remotely monitor various environmental states of Mooney Lake. I've finally be able to get it up and running, and it's now attached to the side of the dock and transmitting data.

Goals:
  • Remotely monitor lake level, lake water temperature, air temperature and air humidity. I also attached a photocell to measure ambient light levels just for the heck of it.
  • Log the data, push it to the "cloud", and graphically display it on the Mooney Lake website. 
Current Status:
  • The sensor package appears to be working, and it's transmitting data to my laptop in the house.


Next Steps:
  • Write some code in Processing or Python (I'm not sure which yet) to push the data to Google Docs. My initial plan is to use Google Docs to log the data and generate graphs depicting trends over time. I'm hoping this will be the easiest method to create graphs that I can then pull into the Mooney Lake website. An alternative would be to directly create the graphs using Processing, save this as a .jpg then drive the .jpg to the Mooney Lake site.