Bicycle Wheel Lights with Arduino (Pic on p.3)

I'd recently spotted this Kickstarter:

and decided to try make something similar myself. I've never worked with an arduino before but went out today and picked up an Uno R3 at a local store. I am a 3rd year comp sci major, so programming is not a hardship but the hardware side is a bit of a mystery. Can controlling 256 lights with one Uno be done?

What I feel like I will need:

  • an accelerometer (or two) per wheel, or a hall effect sensor to measure rotational speed and an orientation sensor
  • enough LED multiplexors to control this thing

Yes controlling can be done, but you will need an external power supply, because 256 LEDS will draw much more power than the arduino can supply. e.g. if you are using LEDs that need 20mA, you will need 256*20mA=5,12A.

Cheers,
I was indeed planning on supplying it with a battery pack.

Are tightly grouped LED strips available? I've been looking but the closest I've found is a 32 LED strip that's 1m long. I would need 32 LEDs in 33cm.

yarko:
Cheers,
I was indeed planning on supplying it with a battery pack.

Are tightly grouped LED strips available? I've been looking but the closest I've found is a 32 LED strip that's 1m long. I would need 32 LEDs in 33cm.

How about this?

http://www.ebay.com/itm/300912911837

fungus:

yarko:
Cheers,
I was indeed planning on supplying it with a battery pack.

Are tightly grouped LED strips available? I've been looking but the closest I've found is a 32 LED strip that's 1m long. I would need 32 LEDs in 33cm.

How about this?

http://www.ebay.com/itm/300912911837

Thanks,
That's exactly what I found as well on aliexpress. I'll order a meter when I get a more or less full parts list in order. Could I use FastSPI to control these lights without an LED driver?

I'll be putting in an order today for a metre of that WS2811 light strip, a couple of ADXL345 and ADXL335 accelerometers, and a TLC5940 (just in case, perhaps for the future). Then the fun will begin with programming the animations and getting the accelerometers to read the speed of the wheel. I'm thinking of putting a single strip across one entire wheel to start, instead of 4 quarter strips. Hopefully I will use it only in the sun, as I couldn't find any weatherproof LED strips with that density. But I will program in for half the resolution as well, as the best weatherproof strips I could find were 60/m.

I have gotten the hall effect sensors I'd picked up yesterday working and have figured out a way to make this entire project work with only the hall effect sensors instead of the accelerometers. I have some A1106 sensors that are a bit on the weak side for my liking. Would a stronger magnet or a better sensor be more worthwhile?

I’ve been programming an algorithm for scanning in images to be displayed by the wheel lights. I’m doing it in Java because it’s what I’m most familiar with. How would the arduino have the RGB values stored? I’m exporting them to a .txt for now, not sure how to to interface with that.

This is the code so far: (The “spokes” are light strip positions during rotation. The output.txt file is acting strange though, not making 200+ lines of spoke values but only like 87 lines.)

import java.awt.Color;
import java.awt.image.*;
import java.io.*;

import javax.imageio.*;

public class main {


	public static void main(String[] args) throws IOException
	{
		BufferedImage img = ImageIO.read(new File("Color Wheel.jpg"));
		int[][][] colorArray = colorArray(img);
		
		writeWheelToText(colorArray);

	}
	
	public static int[][][] colorArray(BufferedImage image)			//returns an array of RGB colors corresponding to each pixel
	{
		int width = image.getWidth();
		int height = image.getHeight();
		
		int[][][] result = new int[width][height][4];
		
		int row = 0; 
		int col = 0;
		
		while (row < height)
		{
			Color c = new Color(image.getRGB(row, col));
			result[col][row][0] = c.getAlpha();				//get alpha
			result[col][row][1]	= c.getRed();				//get red
			result[col][row][2] = c.getGreen();				//get green
			result[col][row][3] = c.getBlue();				//get blue
			col++;
			if (col == width)
			{
				row++;
				col = 0;
			}
		}
		return result;
	}
	
	
	public static void writeWheelToText(int[][][] colorArray) throws IOException
	{
		BufferedWriter print = new BufferedWriter(new FileWriter("output.txt"));
		PrintWriter out = new PrintWriter(print);
		
		int pixels = 36;																//CHANGE TO 15 IF USING A 15 LED STRIP, OTHERWISE SET TO 36 LED STRIP
		int numOfSpokes = (int)(colorArray.length * Math.PI);
		//int[][] wheel = new int[numOfSpokes][pixels];
		
		int center = colorArray.length / 2;
		
		for (int spoke = 0; spoke < numOfSpokes; spoke++)
		{
			double angle = spoke * ((2 * Math.PI) / numOfSpokes);						//angle of current spoke, starting at 0 degrees, which is...
			
			for (int pix = 0; pix < pixels; pix++)
			{
				double xDist = Math.cos(angle) * (pix);									//distance in the x direction to get the pixel of pix
				double yDist = Math.sin(angle) * (pix);
				
				int xVal = center + (int)xDist;											//may need to include an offset for the hub
				int yVal = center - (int)yDist;
				out.print("" + colorArray[xVal][yVal][1]);								//CHECK IF THiS WILL ROUND DOWN xDist and yDist
				out.print(" ");
				out.print("" + colorArray[xVal][yVal][2]);
				out.print(" ");
				out.print("" + colorArray[xVal][yVal][3]);
				
				out.print("\t\t");
			}
			
			out.print("\n\n\n");
			
		}
		
		out.close();
	}
	

}

I switched that out.print("\n\n\n"); command to an out.println(); and everything is fine now. Way to go, Java.

Is there a simple way to store loads of data on the Arduino? I’ll probably have to get an SD card shield in order to store the animations on the wheels. Just one frame of an animation takes up 86kb of a .txt file.

right,the closest I've found is a 32 LED strip that's 1m long. I would need 32 LEDs in 33cm. thanks

musicko:
right,the closest I've found is a 32 LED strip that's 1m long. I would need 32 LEDs in 33cm. thanks

Plenty of 60/m strips:

baqir:
if you are using LEDs that need 20mA, you will need 256*20mA=5,12A.

While a battery pack is probably essential, it may be a lot less than 5.12A. Those images are static on a rotating wheel, which implies persistence of vision is exploited a lot, the LEDs spend a lot of the time being off, and the whole thing is governed by the road speed. You might also consider the intellectual property issues here. If you see a highly-paid lawyer pedalling up the road on a very strange bike, remember where you heard it first.

Wow I like those 144 pixel strips. :wink:

Here another example of the same principle:

matchy:
Here another example of the same principle:
The Future Is Now - Visual poi vid - YouTube

Kinda. The bicycle wheel one has a way to "stabilize" the image so it remains in one place while the wheel is spinning, regardless of speed. The Pyroterra staff and pois don't have that. In a sense they are much simpler.

The Monkey Light uses gyros and accelerometers to stabilize their image, as is demonstrated when a bike is lifted above a man`s head and the STOP sign is still oriented to the ground, not the position of the bike. I think it easier to track the speed of rotation by the use of a few hall effect sensors on the wheel and a magnet on the fork of the bike. This can give the angular velocity of the wheel, which I can use to predict what images to be shown until the next hall effect sensor is triggered, providing an updated angular velocity and position of the wheel. Just my thinking.

I've received a 1m strip of the WS2811 LEDs and hooked everything up to my Arduino. Loaded up the FastSPI test code and had it run, kinda. The lights only cycled through the first ~50 lights (of 144) in a very sporadic way and after only the first light was left flashing green in the same twitchy way. I tried the Adafruit Neo Pixelmaster and a similar thing happened. I'm powering the Arduino through a Firewire cable from my PC. Is it not enough juice or do I need to set up FastSPI differently than in the test code?

I'll probably be heading out to my local tech supplier and could pick up a battery enclosure.

You need to power those LEDs from an external power supply with a much higher amp rating than what the Arduino can supply. Got a spare computer power supply? Use that. Connect the Arduino ground to the PSU ground, connect the Arduino to your computer, and the LEDs to the PSU. Let 'er rip.

KirAsh4:
You need to power those LEDs from an external power supply with a much higher amp rating than what the Arduino can supply. Got a spare computer power supply? Use that. Connect the Arduino ground to the PSU ground, connect the Arduino to your computer, and the LEDs to the PSU. Let 'er rip.

Might require a pretty long extension cord which might still limit his bicycle trip durations?

Lefty

retrolefty:
Might require a pretty long extension cord which might still limit his bicycle trip durations?

Oh absolutely! :slight_smile: