Thursday, July 30, 2009

R/C

Been working the last few days fixing up all of the R/C gear I have laying around. Completely rebuilt my onroad glow powered car. In the process I snapped the arm on the servosaver :( Going to need to get a new one to steer. However, I was able to get the motor tuned up which makes me happy. Now just need to get a car for my brother so we can race.

Also trying to organize my projects. I have way too many open projects at the moment. Got to try to focus on them one at a time and hammer away at them. Get the number down so that they are a tad more managable. Have like 7 or 8 unfinished rockets. Most of them just need to be painted. A few need some more structural work. But for the moment I am focusing on a balsa and tissue paper model I have. It is coming together alright. Haven't built one before so it is a bit of an adventure. Must say I like laser cut wood more than die cut in a kit. Hopefully can get through some more of that tomorrow. Have the tail surfaces complete, and the fuselage laid out. Next is the wing and then all the struts for the wing and fuselage.

Also found a cool program to play with. caDNAno (www.cadnano.org), for designing folded DNA structures. Also reading the Nature article describing the folding process (Nature 2006, 440:297-302)

Friday, July 24, 2009

Have so many project ideas running through my head. Need to have the resources to work on some of them..... Working on a small balsa and tissue paper model I have had sitting around for a while. Slowely getting that done. Limited by the speed that the glue dries. Probably finish it by this weekend.

Have also been fixing up all my R/C gear. Haven't done model airplanes since 2000. Use to have a couple nice ones. I am looking into the electric park fliers. Much more impressive now than when I got into R/C. Also much simpler to operate than the nitro powered models. Though when i have good cashflow and time I will make some of those as well. Just tough with those since you nearly need to make a day of going flying, while the electrics you can just do quickly.

Friday, July 17, 2009

In addition to having a library for the LED cube, I now have laid out an Arduino shield in Eagle for it. Have a friend who has a laser printer printing the masks for me so I can transfer them with a heating iron onto a blank circuit board and then etch it. Will have to see how it comes out, but I think it should work well. Might take a bit to get the toner transfer method to work however. But once i get the board etched its going to be great.

And found out that they still make the type of toolchest my father has. It is so nice.... think I need to get one someday.http://www.fastenal.com/web/products/detail.ex?sku=0207061&ucst=t

Wednesday, July 15, 2009

LED cube greatness!

YAY! I have a working c++ library for developing control programs for the 3x3x3 LED cube. Additionally I figured out the Arduinos interrupt scheme (forgot to add a 10 kohm resistor creating odd behavior all day) so I can switch between the patterns easily. Next step is a simple self contained control board with an atmega168. Should be fairly simple, only really 4 systems, a 5v power supply, a 16 mhz oscillator, the atmega and then the final I/O devices (LEDs and a button). Only problem is that after the interrupt it still finishes the current pattern. Not a huge deal, but could be confusing if you didn't know that it would do that.

Friday, July 10, 2009

Built a frame for the servo motor vehicle. Also built a battery mount with some sintra and have that powering the arduino. No more USB cable tether, YAY!!!!!! Next problem to tackle... traction.


Thursday, July 9, 2009

Using the two hacked servos from the other day I decided to make them into a simple mobile platform. In addition I have a Wiimote nunchuck connected via the nunchucky from www.solarbotics.com. I am using the joystick to control the rotation of the two servos. The buttons and accelerometer data however are not used for anything so far with this experiment. I used some code that I found on the web that used the Arduino to decode the data from the nunchuck via the I2C connection and then send it to a terminal program using a serial interface. I then modified it to give abbreviated data data to the serial terminal, and also to drive the motors using PWM output from two of the Arduinos digital I/O pins.

So.... here is the code.... and yes... I know I need better comments....

/*
example code from www.windmeadow.com/node/42 modified to drive two continuous
rotation servos as PWM controlled gear motors.

uses the analog pins for nunchuck connection
analog 4= data
analog 5= clock

nunchuck uses 6 bytes for full set of data
0: x axis of analog stick left(min) 0x1e, center 0x7e, right 0xe1
1: y axis of analog stick down (min) 0x1d, center 0x7b, max 0xdf
2: x acceleration 1g (min) 0x48, medium 0x7d, max 0xb0
3: y acceleration 1g (min) 0x 46, medium 0x7a, max 0xaf
4: z acceleration 1g (min) 0x4a, medium 0x7e, max 0xb1
5: buttons/ alleleration LSB:
bit 0 z button (0= pressed)
bit 1 c button (0= pressed)
bit 2 and 3 x acceleration LSB
bit 4 and 5 y acceleration LSB
bit 6 and 7 z acceleration LSB
Scott Powers
6-10-2009
*/

#include Servo.h //stuff in italics needs to go in angle brackets
#include string.h
#include Wire.h

#undef int
#include stdio.h
Servo leftMotor;
Servo rightMotor;
uint8_t outbuf[6]; // array to store arduino output
int cnt = 0;
int ledPin = 13;
int delayTime = 50000;

void
setup ()
{
Serial.begin (19200);
Serial.print ("Finished setup\n");
Wire.begin (); // join i2c bus with address 0x52
leftMotor.attach(10);
rightMotor.attach(9);
nunchuck_init (); // send the initilization handshake
}

void
nunchuck_init ()
{
Wire.beginTransmission (0x52); // transmit to device 0x52
Wire.send (0x40); // sends memory address
Wire.send (0x00); // sends sent a zero.
Wire.endTransmission (); // stop transmitting
}

void
send_zero ()
{
Wire.beginTransmission (0x52); // transmit to device 0x52
Wire.send (0x00); // sends one byte
Wire.endTransmission (); // stop transmitting
}

void
loop ()
{
Wire.requestFrom (0x52, 6); // request data from nunchuck
while (Wire.available ())
{
outbuf[cnt] = nunchuk_decode_byte (Wire.receive ()); // receive byte as an integer
digitalWrite (ledPin, HIGH); // sets the LED on
cnt++;
}

// If we recieved the 6 bytes, then go print them
if (cnt >= 5)
{
move ();
}

cnt = 0;
send_zero (); // send the request for next bytes
delayMicroseconds(delayTime);
}

// Print the input data we have recieved
// accel data is 10 bits long
// so we read 8 bits, then we have to add
// on the last 2 bits. That is why I
// multiply them by 2 * 2
void
move ()
{
int joy_x_axis = map(outbuf[0],0x1E, 0xE1, 0, 180);
int joy_y_axis = map(outbuf[1],0x1d, 0xdf, 0, 180);
int turn= joy_x_axis-88;

int z_button = 0;
int c_button = 0;
int left=(joy_y_axis+turn);
int right=(180-joy_y_axis+turn);

rightMotor.write(right);
leftMotor.write(left);

// byte outbuf[5] contains bits for z and c buttons
// it also contains the least significant bits for the accelerometer data
// so we have to check each bit of byte outbuf[5]
if ((outbuf[5] >> 0) & 1)
{
z_button = 1;
}
if ((outbuf[5] >> 1) & 1)
{
c_button = 1;
}

Serial.print (joy_x_axis, DEC);
Serial.print ("\t");

Serial.print (joy_y_axis, DEC);
Serial.print ("\t");

digitalWrite(13, z_button);
Serial.print (z_button, DEC);
Serial.print ("\t");

Serial.print (c_button, DEC);
Serial.print ("\t");

Serial.print ("\r\n");
}

// Encode data to format that most wiimote drivers except
// only needed if you use one of the regular wiimote drivers
char
nunchuk_decode_byte (char x)
{
x = (x ^ 0x17) + 0x17;
return x;
}


Sunday, July 5, 2009

servo mod

Last night I decided to modify a couple of the standard size servos I had laying around to function as continuous rotation gear motors. The servos are Futaba S3003 from a model airplane that I built in high school that was damaged beyond repair. I havent built any more large model airplanes so I have these laying around.

This mod was focused on the final gearm so that it would no longer engage the potentiometer. The pot gives rotation feedback to the servo circuitry.
*After disassembly a notch was cut into the top of the pot with a dremel so that the pot could be turned with a precision standard head screwdriver.
* After this the tab on the side of the final gear was removed so that it no longer engaged the stops built into the top of the case.
* the bottom interior of the gear contains posts to engage the pot. These were removed with a 5/32 drill bit.
* the hole from the top was also reamed out with a 5/64 bit so that a precision screwdriver could fit through the gear. This allows adjustment so that the pot can be set to the neutral position.

Once the servo was reassembled I hooked it up to the arduino on one of the PWM pins. I then used the following code so that I could adjust the pot to neutral where the motor is stationary.

#include servo.h
Servo myservo;
int pos = 90;
void setup()
{
myservo.attach(9);
}
void loop()
{
myservo.write(pos);
}

This mod allows the servo to be used like any other motor using PWM output at 5v from the arduino digital I/O pins.


Wednesday, July 1, 2009

Back into electronics and robots


Well.... I have been out of work for a bit and beend taking the time to work on some electronics projects and robots. Built a 3x3x3 LED cube controlled by an arduino microcontroller. It is the first arduino project I have worked on. So far I am very pleased by the ease of use and functionality. After the first few patterns programming in C has come back to me. It is just a matter of learning some of the built in functions for the arduino. Overall not back. Hopefully will add some pictures and code later on.

Also build a Lego NXT run Sumobot. Would like to spend more time working on robotics and the such. Maybe even go to some competitions. Will see where things go in time.
Now I just need to get back on the job so that I will have money for some of these projects.....