Bicycle Quick Release Headlight

November 23rd, 2011 pchretien No comments

I published a new thing on Thiniverse.com http://www.thingiverse.com/thing:13877 This thing is a quick release bicycle headlight using magnets. I bought the magnets in a garage sale so I can’t really help you find the same magnets.

Instructions

Print the parts:
—————-
2 x clip2.stl
1 x magneta.stl
1 x magnetb.stl

Attach one clip2.stl to magneta.stl using a 1/2″ 6-32 bolt.
Attach the other clip2.stl to magnetb.stl using a 1/2″ 6-32 bolt.
Attach the base to the bicycle handle bar using a 1 1/2″ long 6-32 bolt.
Attach the light to the upper part using a 1 1/2″ long 6-32 bolt.
Superglue the magnets on the bottom of both magneta.stl and magnetb.stl

Make sure you align the small notches in the right direction for your setup.

What’s Next

  1. Would be nice to derive a new thing using more standard magnets.
  2. Making it in OpenScad would allows parametric parts.
  3. Adding new connectors to attach a camera, a map, …

 

 

 

Atmega328 Vcc pin

October 13th, 2011 pchretien No comments

I received a comment from “N00B” on my Build an Arduino Clone post pointing out a mistake I made by connecting 5V power to the pin #6 instead of pin #7 of the Atmega328 micro-controller.

He was right and I changed the text of the article from pin #6 to pin #7 but, what puzzled me is that the circuit I made for this article was actually using pin #6 to power the micro-controller.

A basic Arduino clone

A basic Arduino clone - Vcc on pin#6 !!!

I still have this circuit all wired up in my lab. I validated that it works as well powered on pin #6 as on pin #7. How can that be? Anyone can explain that one to me?

Stars Trackers

September 27th, 2011 pchretien 1 comment

I posted these two barndoor mounts on Thiniverse a few days ago. One is manually operated while the other is motorized.

Manual Stars Tracker kit:
http://www.thingiverse.com/thing:11376

Manual Stars Tracker

Manual Stars Tracker

 

Motorized Stars Tracker kit:
http://www.thingiverse.com/thing:10756

Motorized Stars Tracker

Motorized Stars Tracker

Since I have not that much time on my hands, I decided to merge both projects so that I can chose between the portability of the manual version and the ease of use and accuracy of the motorized version.

The new manual version looks pretty much like it’s ancestor with some minor modifications. The length of the device has been cut in half and some minor bugs have been fixed.

New version of the manual Stars Tracker

New version of the manual Stars Tracker

I am now working at motorizing this new version of the manual Star Tracker. I want to make it simple to switch from the manual to the motorized version by reusing as much parts as possible.

I ended up today with this motor support that should replace the actual wheel of the Star Tracker.

Motor Mount for the Motorized Stars Tracker

Motor Mount for the Motorized Stars Tracker

I am using the same type of attachments as the frame of the Makerbot. This technique is pretty cheap and allows strong assemblies using plastic and wood.

Next step will be to design a coupling to attach the motor to the 1/4″ threaded rod of the tracker. I think I’ll use the same type of coupling as the Reprap 3D printer.

The Maker Faire World in New York

September 24th, 2011 pchretien No comments

Following the Open Hardware Summit I went to the Maker Faire World in New York city. This event was held in the same location as the OHS, at the New York Hall of Science.

Maker Faire World 2011 New York

Maker Faire World 2011 in New York city

3D printers were all over the place! Of course there was the 3D printing village where Makerbot, Makergear, Ultimaker, Botmill and other companies were exposing their stuff but you could also see a Makerbot in almost every booth of the exhibition.

Tony Buser showing its 3D prints

Tony Buser at the Makerbot booth

3D printed Molecules

3D printed Molecules

Of course, there was not only 3D printers at the Maker Faire … We had a gigantic dinosaur/dragon throwing fire, a car covered with dancing fish and lobsters, bamboo bicycles and much more …

Steel and Fire

Steel and Fire

Fish/Lobsters Car

Fish/Lobsters Car

Bamboo bike in construction

Bamboo bike in construction

These are only 1% of all the great stuff you can find at the Maker Faire. This alone  totally worth the trip from Montréal to New York!

For more information visit the Make Magazine website at makezine.com.

Open Hardware Summit

September 16th, 2011 pchretien No comments

This was my first time at the ohsummit. The day was filled with great quality talks from speakers of all disciplines.

Open Hardware Summit

Open Hardware Summit

 

I first want to thanks Alicia and Ayah, the organizers for their great work. Everything was planned with details and efficiency.

The day had a great start with the presentation from Eric Wihelm, founder of Instructables. He demonstrated the power of kids creativity by presenting kids projects using Kinect blocks. These young members of the Instructable community have designed, built and improve Kinect guns, ranging from the pistol to the machine gun.

All the legal stuff has been packed in the morning sessions so that the afternoon talks  were much more practical and, from my point of view, more interesting.

Gabrilla Levine presented a sailboat drone intended to clean up oil spills in water. The talk was loaded with project management experiences and tips.

Zach Liberman presented an earth touching talk about a device that allowed a paralyzed artist to make painting for the first time in years.

A few talks later, Bre Pettis talked about the creativity of the Thingiverse members by showing the evolution of some fun prints. The gangsta man transformed into a gangsta rabbit, a rabbit with a Colbert head, etc.

There were lots of other talks in the afternoon. I loved the presentation by the Lasersaur team. They managed, with very little fabrication skills, to build a fully functional four by two feet laser cutter. Great project!

The last talk has been made by Mitch Altman, the inventor of the TV B Gone. That was a very inspiring presentation where he invited the audience to invest their time in project they love!

To close the day there was breakout sessions and demos of the attendees projects. Our breakout session was about how to build and maintain a collaborative community of makers. Three speakers presented their projects and the way they managed their respective open source project.

Makerbot Headquarter

Makerbot Headquarter

Passed 20h, Hugo and me took a cab with two other peoples to the Makerbot party at their headquarter in Brooklyn. I met with great quality peoples from all over the world. I discussed my stars tracker with three members of the Makerbot team.

Tomorrow is off and Saturday I’ll head to the Maker Fair!

Parametric Arduino Case

September 12th, 2011 pchretien No comments

When you make a project using an Arduino board, you often need a case to attach the Arduino onto your project. This small project is my first attempt to make such a case that can be adapted to all my projects.

Parametric Arduino Case

Parametric Arduino Case

 

 

To make it parametric I am using the OpenScad application. OpenScad is an open source  3D modeling software that allows you to model your objects using a dedicated scripting language. Because your object is made out of code, it is easy to make designes that are defined by configurable parameters.

Openscad

Openscad

 

 

Following is the code of the arduino case. As you will see at the top of the listing, many variables are defined so that you can adapt the object to your needs.

arduino_width = 54;
arduino_length = 69;
arduino_usb_width = 13;
arduino_usb_height = 15;
arduino_usb_x = 9.5;
arduino_power_width = 9.5;
arduino_power_height = 15;
arduino_power_x = 3.5;

wall_thickness = 2;
wall_height = 7;
bottom_thickness = 1;
side_shoulder = 6;

difference()
{
	// Exterior box
	cube([arduino_width+(2*wall_thickness),
              arduino_length+(2*wall_thickness),
              wall_height+bottom_thickness],
              center=true);

	// Interior recess
	translate([0,0,bottom_thickness/2.0])
		cube([arduino_width,
                      arduino_length,
                      wall_height],
                      center=true);

	// Bottom hole
	cube([arduino_width-(2*side_shoulder),
              arduino_length-(2*side_shoulder),
              wall_height+bottom_thickness],
              center=true);

	// USB hole
	translate([-1*((arduino_width/2.0)-(arduino_usb_width/2.0)-arduino_usb_x),
		    -1*(arduino_length/2.0)-(wall_thickness/2.0),
		    -1*(wall_height/2.0-arduino_usb_height/2.0)+bottom_thickness/2.0])
	{
		cube([arduino_usb_width,
                      wall_thickness,
                      arduino_usb_height],
                      center=true);
	}

	// Power hole
	translate([((arduino_width/2.0)-(arduino_power_width/2.0)-arduino_power_x),
	    -1*(arduino_length/2.0)-(wall_thickness/2.0),
	    -1*(wall_height/2.0-arduino_power_height/2.0)+bottom_thickness/2.0])
	{
		cube([arduino_power_width,
                      wall_thickness,
                      arduino_power_height],
                      center=true);
	}

}

Visit my page on Thiniverse to get more details about this project. I invite you to explore this huge repository of objects. The future of 3D printing is great and this site is there to lead the way.

 

Maketbot and Open Hardware

September 11th, 2011 pchretien 2 comments

Five months ago I wrote my last article on this blog … Five months ago, I also got my brand new Makerbot! I love so much making stuff with it that I forgot to write on my blog.

Now I am ready to share this with you. I am preparing some nice articles on this topic but you can visit my page on Thiniverse to see what I did so far.

I’ll be at the Open Hardware Summit next week (Sept. 15) in NY and at the Maker Fair the following weekend. I’ll post here some articles ant pictures if I can manage to get some free time.

Arduino Motor Controller Using an L293D Chip

April 22nd, 2011 pchretien 2 comments

Controlling DC motors is at the heart of many robotic projects. Servo motors are sexy but DC motors are cheap and a lot more useful to control wheel based robots. In this article I’ll display a “robot shield” circuit that allows you to use cheap motors to drive your robot.

Custom robot shield

Custom robot shield

Wiring

This shield has been built on top of the Adafruit Prototype Shield. Using the prototype shield makes it much simpler to develop a custom Arduino shield. You can get one from Adafruit here.

The assembly is powered by a 6V battery connected to the Vin pin of the Arduino and to the voltage regulator input pin. The voltage regulator output is connected to pin 9 (Vcc2) of the chip to power the motors. The Arduino 5V pin is connected to pin 16 of the controller to power the internal logic. Make sure to use a proper heat sink on the voltage regulator and on the chip (pins 4,5,12,13) if you plan to power the robot with a higher voltage source.

The L293 current driver chip amplifies the input signal received on pins 2, 7, 10 and 15 to outputs pins 3, 6, 11 and 14. This allows us to take a low power signal from our circuit and transform it into a higher power signal for the motors. Using these 4 input/output the L293 can drive two motors forward and backward.

Motor #1 is connected to pins 3 and 6 and motor #2 is connected to pins 11 and 14. To drive motor #1 you apply 5V on pin #2 and 0V on pin #7. To drive the same motor in opposite directions you apply 5V on pin #7 and 0V on pin #2. You can use the same technique to drive motor #2 with pins 10 and 15.

Speed can be controlled by sending a logical pulse to the L293 “enable input” pins. Pin #1 drives the speed of motor #1 and pin #9 of motor #2. The best way to do this is by using the Arduino PWM outputs on pins 9, 10 and 11. In this example, the Arduino pin #10 is connected to the L293 pin #1 and the Arduino pin #11 is connected to the L293 pin #9.

Speed And Direction

There are two methods to control the direction of a wheeled robot. One is to build a direction mechanism similar to cars where the wheels are oriented in the direction you want the robot to go. This method involves complex mechanisms and requires more space for the robot to maneuver.

The alternate method is to drive left and right wheels in opposite directions allowing the robot to make a sharp 360 degrees turn. This method requires no additional mechanism and is much simpler to implement by using a micro-controller. However, this method assumes that both motors are running at the same speed, which is often not the case with cheap motors.

This code shows how to control direction using the L293 chip with an Arduino board.

...

void backward()
{
  digitalWrite(MOTOR_1A, LOW);
  digitalWrite(MOTOR_1B, HIGH);
  digitalWrite(MOTOR_2A, LOW);
  digitalWrite(MOTOR_2B, HIGH);
  checkDistance = 1;
}

void forward()
{
  digitalWrite(MOTOR_1A, HIGH);
  digitalWrite(MOTOR_1B, LOW);
  digitalWrite(MOTOR_2A, HIGH);
  digitalWrite(MOTOR_2B, LOW);
  checkDistance = 0;
}

void right()
{
  digitalWrite(MOTOR_1A, LOW);
  digitalWrite(MOTOR_1B, HIGH);
  digitalWrite(MOTOR_2A, HIGH);
  digitalWrite(MOTOR_2B, LOW);
  checkDistance = 0;
}

void left()
{
  digitalWrite(MOTOR_1A, HIGH);
  digitalWrite(MOTOR_1B, LOW);
  digitalWrite(MOTOR_2A, LOW);
  digitalWrite(MOTOR_2B, HIGH);
  checkDistance = 0;
}

void stop()
{
  digitalWrite(MOTOR_1A, LOW);
  digitalWrite(MOTOR_1B, LOW);
  digitalWrite(MOTOR_2A, LOW);
  digitalWrite(MOTOR_2B, LOW);
  checkDistance = 0;
}

...

For example, the Tamiya double gearbox includes two low cost DC motors. The gearbox is amazing for small robotic projects but heading straight with these motors can be much more difficult than expected.

This is where the L293 chip comes to the rescue. This chip can control both the direction and the speed of the motors. To control the speed of the motors you connect the two PWM digital outputs of the Arduino micro-controller to the enable input pins 1 and 9 of the chip. As explained in the datasheet: “When an enable input is high, the associated drivers are enabled and their outputs are active and in phase with their inputs”.

You are now able to adjust the motor speeds by changing the PWM output value of the enable input of the faster motor. PWM outputs range from 0 to 255 so, to slow down a motor by a ratio of 10% you should set the associated PWM output to 230. Trial an error is the only way to get that done and make your robot head in a straight line.

void setup()
{
...

  pinMode(10, OUTPUT); // To L293 pin #1
  pinMode(11, OUTPUT); // To L293 pin #9
  analogWrite(10, 185); // Faster motor at 72% of its full speed
  analogWrite(11, 255); // Slower motor at 100% of its full speed

...
}

What’s Next

In a future article we will see how to use the shield to drive a simple Robot controlled by an infrared remote control. This project will pack together many tutorials published on this blog. If you have worked with the L293 chip to control motors, let us know in the comment section below.

Wireless Arduino/XBee Game Controller

April 12th, 2011 pchretien No comments

For this project, I keep the same controller as in the previous post but, instead of controlling a servo motor  through a second Arduino, I will use it as a game controller.

The game will be played on my desktop computer. Since I am not very good at writing games, I downloaded the PyGame library. This framework comes with tons of samples so I decided to hack one of these samples and replace the keyboard input with my controller. You move the tank left and right by turning the game controller in the vertical position. You can fire bombs by switching the controller horizontally.

PyGame example game aliens.py

PyGame example game aliens.py

The code and the circuit of the game controller are the exact same setup as in my previous post. What I’ll demonstrate here is how to implement a receiver in this Python game.

You will need to connect an XBee wireless module to your computer using a USB adapter board. This will create a new communication port, in our case COM8.

Arduino/XBee controller and XBee USB adapter

Arduino/XBee controller and XBee USB adapter

The idea is to replace the keyboard with the data coming from the controller through the serial port. To maintain compatibility with the original version, I decided to simply override the keyboard values with the wireless controller commands.

The first step is to load the proper modules and open a connection through the serial port. I will use two global variables to replace the keyboard commands: one for the firing command and the other for the tank direction.

#
# Serial port communication with the Arduino/XBee
#
import serial
import thread
arduinoFiring = 0
arduinoDirection = 0
ser = serial.Serial('COM8', 19200, timeout=0) # Change COM[number] for ttyUSB[number]

Once this is defined, we need to override the keyboard values. To replace the spacebar fire command, we override the value with:

  firing = keystate[K_SPACE]
  firing = arduinoFiring # <-- Override the keyboard with the game controller data

To replace the arrows direction commands, we are add the following lines:

  direction = keystate[K_RIGHT] - keystate[K_LEFT]
  direction = arduinoDirection # <-- Override the keyboard with the game controller value

Finally, we have to feed these two values with the data received from the game controller. The best way to do this is by starting a new thread to listen on the serial port, read incoming data and convert it to game usable values.

def processArduino(buffer):
	global arduinoFiring
	global arduinoDirection

	if len(buffer) == 0:
		return
	if buffer[0] != '<':
 		return
 	if buffer[len(buffer)-1] != '>':
		return

	tokens = buffer[1:len(buffer)-1].split(':')
	if len(tokens) < 4:
 		return
 	for i in range(4):
 		if len(tokens[i]) == 0:
 			return
	#print(buffer)
 	c = int(tokens[0])
 	x = int(tokens[1])
 	y = int(tokens[2])
 	z = int(tokens[3])
 	if y > 550:
		arduinoDirection = 1
	elif y < 450:
 		arduinoDirection = -1
 	else:
 		arduinoDirection = 0
 	if z > 575:
		arduinoFiring = 1
	else:
		arduinoFiring = 0

def readArduino():
	buffer = ''
	while 1:
		b = ser.read()
		while b:
			if b == '<':
 				buffer = ''
 			buffer += b
 			if b == '>':
				processArduino(buffer)
			b = ser.read();

def main(winstyle = 0):
    ...
    thread.start_new_thread(readArduino, ())

We have two functions here. The readArduino() function is the thread entry point that contains the code reading on the serial port. A buffer is built of bytes received from the game controller. When the ‘<’ character is read, the buffer is cleared to receive a new command. When the character ‘>’ is received, the command stored in the buffer is processed.

The data is processed in the  function processArduino(buffer). The data buffer is received as a parameter. The function reads the three axis and the compass values. Then, it determines if the direction is -1, 0 or 1 and if the tank fires a bomb. The values of the axis range from 400 to 600. The constants used in the function to determine the position of the controller can be adjusted to match your game requirements.

 

A simple Arduino Task Scheduler (video)

April 7th, 2011 pchretien No comments

I uploaded a new video to demonstrate the task scheduler in action. In this example I am driving two servo motors, two LEDs and a print-out to the serial port.

You will find more details on how to use the task scheduler on my previous post. The code is available for download from my Github account at: https://github.com/pchretien/scheduler