Wednesday, December 30, 2009

Scopy




To debug the gyro voltage on the SharkFin, I made a simple Arduino based oscilloscope. Single channel, no triggers, no frills.

Python, pylab, and gtk are required.

1. upload scope.pde to arduino
2. edit scopy.py to point to your Arduino (see Tools->Serial Port in Arduino IDE)
3. run scopy.py on computer
4. if you improve either, please send me the update.

Tuesday, December 15, 2009

BEBL Takes "Light Up the Night" Grand Prize!



WOW, Instructables just announced that the BEBL won the Light Up the Night Contest! They are shipping out the sweet Grand Prize "Urban Awarness Jacket" from Cordarounds.

I entered the contest on a lark when I entered the Arduino Contest. Who would have guessed?

Thanks for all the support!

Thursday, December 03, 2009

BEBL Instructable takes 2nd Prize

The BEBL instructable took 2nd prize in the instructables Arduino contest. Thanks to everyone who voted!

Saturday, October 31, 2009

Take the BEBL Challange!

In order to encourage people to make the BEBL, I am offering $35 to the first person to build and demonstrate a functioning BEBL system. That should be enough to cover the cost of the electronic components.

To claim the prize, post a video on line of your accomplishment demonstrating functionality both on and off the bike. The video should include close-ups of the completed hardware. I will address any assembly questions posted here or at Instructables.

Good luck!


The Bar End Brake Light instructions have been made into an instructable and entered into the Arduino Contest.

Sunday, October 25, 2009

Jack-o-duino

Elizabeth and I were inspired this entry in the Instructables Arduino contest. We replaced the servo with a relay to the same effect. It's loud. If we were bomb makers, we'd be dead several times over. Source code can be found here.
video

Tuesday, October 13, 2009

Arduino contest at Instructables!

Keep an eye out for BEBL on Instructables.com. I'll be entering it into the Arduino contest.

Saturday, September 19, 2009

BEBL: Updated schematic

Here is the latest schematic for the Bar End BrakeLight BEBL. Got in the first test ride and it performs amazingly well. The response time seems almost clairvoyant. Ahhh, it feels so good when it stops hurting.

The main change is the power supply fix mentioned in the previous post. The 6V battery I used is this one from RadioShack, but you can find it cheaper on the web. Other changes to note are the power select jumper and the power switch.

The power select jumper allows switching power between the regulated 3.3v from the accel and 5V USB power. This allows the unit to be programmed. The 5V from the USB only powers the micro controller. The 3.3V sensors are therefore protected from the extra voltage. AREF remains connected to 3.3V. I found the switch S2 at Radio Shack. It is perfect. You can access the switch and it stays concealed under the bar. Sweet.

Friday, September 18, 2009

Duh, use the 3.3 Volt regulator on the accel!

So there was a current issue with running directly off of the battery. I was getting variable readings on the accel when no accelerations were being applied. I'm no EE, so power supplies are a mystery to me. May be the unregulated power was experiencing boom and bust cycles like Wall Street.

Then I remembered the 3.3V regulator on the accel breakout from pololu. Now I run the power right into Vin on the accel and power the rest of the circuit off of the 3.3V regulated output-- fixed. I'd appreciate any better explaination if you know have one.

Now back to the software.

Monday, August 31, 2009

Bar End Brakelight Working... kinda.

So the hardware on the bar end brake light prototype is complete.


I need to work on the software to get the sensitivity right (solution posted here). The initial code only used one axis of accel data. Better to use two and compare against a floating reference. If an absolute reference (say horizontal) is used, stopping on a hill might trigger the brake light. So more work to come.

I was definitely pleased with the package which slides right into the bar snuggly. I had to shave off some plastic on the DIP socket to get the oscillator to fit. The chipped part above (upper left of IC) is a testament to the snug fit. I used an unregulated 6V mini battery to power the circuit which is the max voltage rating for the Mega. The accel has its own 3V regulator. The accel reading seems to be coupled with the LED on/off state. Maybe I need larger caps on the digital and analog pins. Any ideas welcome.

I use the arduino environment to program the Mega. Below is my development board with the same accel plus a gyro that will eventually go on the SharkFin. After I program the chip, I pop it into the socket on the bar end unit.

Dev Env


This picture shows the unit installed. I found the perfect switch at Radio Shack (see bottom of picture).

Saturday, August 22, 2009

Bar End Brakelight

I've been making progress on integrating the gyro with the accel. When the electronics are done there is still the whole question of packaging! I decided to put togethere a simple bar end break light to get the most bang for the buck early on. Need to add the oscillator and a switch and I'll be up and running.

Here is a pic with a wine cork for size comparison.


And simplified schematic.

Friday, July 17, 2009

SharkFin

Here is the schematic for a new helmet mounted break light I've been working on. The idea is to measure acceleration and rotation enough to detect breaking from any head angle. Working on the filter now. The prototype is based on the Boarduino from ladyada.net with two breakout boards available from pololu.com.


Saturday, July 04, 2009

Improved brake light

So the brake light was acting a little flaky, turning on over bumps at random. Before, I was using a moving average filter, with ad-hoc checks. I decided to try out a IIR filter because they can produce good results with few taps. This is my first implementation of such a filter.

Infinite impulse response or IIR filters combine measured (feed forward) data and filtered (feed back) data. They get their name because a single non-zero input sample followed and preceded by all zeros can cause the filter to oscillate indefinitely as opposed to a finite impulse response or FIR filter which will return to zero after at most N measurements where N is the number of filter coefficients.

The problem with the brake light was that high frequency jitters were tripping the braking threshold. The only information I really car about is sustained braking, which is low frequency information. I needed a low pass filter, a filter that passes low frequency information and attenuates high frequency information. The Butterworth filter is a low pass IIR filter that is working great for this application.

The filter coefficients are determined by the sample interval, the cutoff frequency, and the number of filter coefficients to use. I chose 2 Hz to be the cutoff frequency. Any lower frequency would delay brake indication, any higher frequency could let in unwanted jitter. I wanted to keep the number of filter coefficients small so that the micro could keep up, It is having no trouble with that; I could probably get away with more filter coefficients, but that delays response time as well.

I was pleased to see how well this filter performed!
I captured this acceleration data riding up and down the street without braking and with. In each image, the raw data is pictured in blue, the filtered data is in yellow, and braking threshold (on the top plot) is indicated in red. As you can see, the raw data is very noisy. The noise is actually bumps on the side of the road, so don't blame the pololu 3-axis accelometer ($17.95!!) breakout I'm using. I purposely aimed for them to make sure the threshold was not set to high which could set of the brake lights every time you hit a bump. With the unfiltered data, it is impossible to set a consistent threshold for turning on the brake lights. The filtered data works though!

The above image just was captured with out braking. I just rode up and down the street without touching the brakes. The threshold was set near the minimum filtered acceleration in the X direction.

This data was collected getting up some speed and braking to various degrees. The X direction is in the velocity direction. Deceleration is indicated by lower X values. You can see the braking go below the threshold even for mild braking.

The Y and Z axis will be used for a future helmet mounted version.

Here is a snap of my data capture setup, thanks to the wave shield from ladyada, and battery and dual proto board from liquidware.com








Here are the filter coefficients, they should work with any IIR filter implantation. The complete BikeLight5 code can be found here.

// feed forward coefficients
double ff[] = {
1.93545410516e-06,
5.80636231547e-06,
5.80636231547e-06,
1.93545410516e-06
};
// feed back
double fb[] = {
1.0,
-2.94973583971,
2.90072698836,
-0.950975665016
};

Sunday, June 07, 2009

Arduino on a bread board.

I've got a couple of ideas for AVR chips freed from the arduino board. Below is my scratch built* arduino. Thanks to LadyAda for posting the schematic for the BoardDuino. Schematic to come.



* By "scratch built" I mean, assembled from the contents of the boardduino kit.

Saturday, April 18, 2009

Reuben Margolin

Watch this video of a Genius at work.
http://blog.makezine.com/archive/2009/01/maker_profile_kinetic_wave_sculptur.html

Wave Shield almost there.

Lady Ada pointed out R1 was missing, now the SD works! The D2A seems to be the next hurtle.

Sunday, April 05, 2009

Arduino Wave Shield HELP!



I am having trouble with the arduino wave shield by ladyada. I really only need to get the SD card reader up and running. After assembling and programming I get the error messages:

-- Card init. failed! (most of the time)
-- Couldn't open filesys (once in a while).

The 2 GB card is formated as FAT16, with 8.3 filenames. Any suggestions welcome.

Sunday, March 15, 2009

MeggyJr Build.


Evil Mad Scientists

Elizabeth and I wanted an excuse to try out the sweet MeggyJr kit from the Evil Mad Scientists Labrotories (EMSL). She has invented a game called Light and Heavy that MeggyJr will be perfect for.

The kit is fantastic, by far the best electronics kit I have ever built. Extreme care has been taken to maximize your probability of a successful build. The detailed color instructions are included with the kit so you won't have to print those out when the kit arrives. A careful read through before you start might save you hours in the long run, so just do it even if you think you already "get it". Every couple of steps, EMSL include full color pictures of the board so far, which adds reassurance.

If you happen to miss something in the instructions, additional hints are stencilled on the board itself "J1 Other Side" for instance.

The parts are easy to find in ZipLock bags with the step number clearly printed on the outside. And the parts themselves are well chosen and of high quality and should stand up to some hard gaming.

For future designs, I'd like to see sockets for the ICs, they get soldered directly to the board. Also, the way the screen sits the electrolytic capacitor is a bit awkward. They were obviously trying to keep MeggyJr as thin as possible.

When we powered her up for the first time, MeggyJr loaded Attack of the Killer Tomotoes, but the blue LEDs on a single row did not function. Careful inspection of the LED headers revealed scant solder on a couple of the pins which was easily remedied.

That said, how could I have possibly soldered the TTL programming interface in the wrong way? Anyway I did, and to make matters worse, my iron got switched off about the time I discovered the renegade part. So I ripped out all of the vias (through hole copper) along with the part (I know).

So I'm disappointed, but know EMSL were kind enough to provide two programming methods. So I figure, I'll test out the ISP programming header first. This works! and we can compile games in arduino and burn the games using avrdude by hand. As a fall back, it's great.
(NOTE FROM EMSL: First, for the record of folks reading this in the future: DO NOT go deleting the bootloader just because you don't know what else to do.)

So, relieved that all is not lost, I return my attention to the TTL header. Testing the connections reveals that all but pin 5 are not functional. I add jumpers based on the most excellent schematic EMSL have provided.


Now that all connections are in order, I need to replace the bootloader on the processor. I had no idea this would be so difficult! One issue is that the arduino IDE does not automatically work with mega-isp, an awesome adruino script that allows your arduino to operate as an avrisp, and the only way I have to upload the bootloader. It took a while to get the right combination of lock and fuse bits but I finally got avrdude to do the dead. Elizabeth and I literally jumped up and down when we loaded MeggyJr_FroggyJr via the TTL port. Here is the script that finally worked.

#!/bin/sh
OPTS="-c avrisp -p m168 -P /dev/ttyUSB0 -b 19200"
avrdude $OPTS -U efuse:w:0x00:m -U hfuse:w:0xdd:m -U lfuse:w:0xff:m
avrdude $OPTS
-U lock:w:0x3f:m
avrdude $OPTS -U flash:w:ATmegaBOOT_168_diecimila.hex:i
avrdude $OPTS -U lock:w:0x0f:m # this was the culprit




Monday, March 09, 2009

COMPLETE!


Let me know if you have any questions!

Monday, February 23, 2009

Bikelight Schematic




Here is a sketch of the schematic. It is composed of three pieces: the SPI interface, the accelerometer circuit and the turn signal circuit. The pin names used in the code are indicated on the right.

Sunday, February 22, 2009

Amy's Bikelight

Stay tuned. The brake light accelerometer was hindered by a bug in the arduino pulseIn code, which has been fixed. I also added LED feedback for the turn signal switch.

Emily has taken a couple of videos, that we will post soon.

Sunday, February 15, 2009

Amy's New Light Arduino Source Code

The code for Amy's bikelight can be downloaded here.

Tuesday, February 10, 2009

Monday, February 09, 2009

Amy's new Bike Light!

This bike light is made from an arduino, and two LED matrices from SparkFun. An accelerometer controls the break lights and a switch controls the turn signals. More details and a schematic later.

Saturday, January 03, 2009

Cycling Shoe Covers

Emily's feet got cold on our ride the other day so I whipped these together for her. I have to make sure she is ready for the "Cycle of Change" ride for Obama's inauguration. The top is a windproof stretchable fleece. The straps are from an old helmet. They worked great!