Wednesday, December 21, 2011

Update: fail-Way gets a new accelerometer

Hooray! More new posts.

I was walking around Fry's and I spotted a Nyko-brand nunchuck for $9 so I picked it up. Testing showed that the nunchuck worked, so I proceeded to open it up. This secific nunchuck had a vibration feature, so there was a small pager motor, as well as some additional circuitry for controlling the motor.


After confirming that it worked, I figured I would try to minimize things, and since I wouldn't be using the joystick portion, I removed it. Unfortunately, the process of doing that resulted in the loss of some SMD components, and the Nyko board stopped functioning correctly. It's not totally broken, as the accelerometer still reports data, it's just very slow and unresponsive at times now. There goes $9. (I did salvage the two buttons, the motor, and the joystick, so I guess it's not a total loss)



Yesterday I was browsing Radioshack and saw a Gigaware-brand (Radioshack's brand or something like that) nunchuck on clearance for $8: even better, if it worked. Tearing into that one showed an even simpler construction, with less wires. After testing that the connector worked, I de-soldered the wires from the board to directly connect my WMP board to the NK board. Luckily the board has convenient labels to show which pad is which.


At first, I was worried because now neither device was responding. After double checking power and data connections, I logically figured out the problem was switched SCL and SDA lines. What had thrown me off was the fact that the Gigaware nunchuck board is mislabeled, with those two lines switched. I did get it working in the end, though.


Now I have a nice and tidy sensor package with convenient mounting holes, ready to be put into use. As a bonous I also get 4 buttons and two 2-axis joysticks.

Sensor costs: $18 for the Wii Motion Plus and $8 for the Gigaware Nunchuck = $26 isn't bad for a 6DOF IMU (for the same functionality as this $60 product, no offense Sparkfun...) [$36 if you count R&D for the Nyko Nunchuck...)

Thursday, December 15, 2011

Update: fail-Way v0.1

Hey look, an update. This is promising.

I've since tracked the problem with my Arduino to a fried diode (I'm assuming I tried to pull too much current through it) which I have since replaced with a piece of wire (since I can't readily buy a replacement). I just have to remember not to apply external power while connected to the computer.

The hardware is essentially the same. I just tried to use less rubber bands on everything (and instead went with electrical tape...)



With a working Arduino again I've continued my quest to make this thing balance. The first thing I did was try to optimize the code by removing all calculations not related to the roll axis (the one I'm using for my robot). I also added a line to convert gyro_roll readings from degrees/second to radians/second. It seems to react faster with radians, so I'll deal with those. It also fixed the problem I was having the the PD control code. Here is the most recent iteration:

Out1Raw += (int) rollCF * KP + rollR * KD;
Out1Srv = map(Out1Raw, -120, 120, 27, 163);
Serial.println(Out1Srv);
motor1.write(Out1Srv);

Lines:
1: PD control code from Shane Colton's SegStick instructable, with my variables
2: the motor controllers I'm using accept servo signals, so I use the Servo library and map the output to controller's range (27-163)
3: debug purposes
4: output to the motor controllers

I still haven't gotten this thing to balance, but I'm closer. It either oscillates rapidly or responds too slowly, so I'm hoping I can fix that by tuning Kd and Kp. I also have some sensor drift problems that are probably related to the unstable nunchuck mounting.

[maybe I'll make this a weekly thing, who knows...]

Wednesday, December 7, 2011

Introduction: the fail-Way, a crappy balancing robot that almost works



"Last post: April 20 2011" This blog is neglected.

I figured I'd document this here, since I intend to actually continue improving on this for a while. Hopefully this won't fade away like my other projects (water rockets, R/C cars, custom laser tag...)

The origin of this project stems from 3 parts:

1) A 4WD robot I built 4 years ago for Science Olympiad
2) A Wii Motion Plus sensor I bought for a quad copter I never built (inspired by this Hackaday post)
3) Buying an Arduino for a Science Olympiad even this year

Having the ease of use of the Arduino combined with the multi-purpose robot was what got me started on the idea of using my WMP sensor and a Wii nunchuck for a balancing robot. Because it was so easy I managed to do it in three days.

I did a lot of research on getting the two sensors to work together, as well as getting useful, filtered data out of them. I'm using the code from that link to fetch the accelerometer and gyro data from the Wii sensors over I2C. It also used some complementary filter to parse the data.

I then used some code from Shane Colton's Segstick Instructable to figure out motor control.

Or at least, tried to. I had to do some clever working around stuff, and rather than convert units or change equations, I just stuck something together to try and make it work. In the end, I had this:

PDangle = rollCF;
PDrate = roll;
PDoutput += PDangle * KP + PDrate * KD;
m1pwr = map(PDoutput, -100, 100, 27, 163);
motor2.write(m1pwr);

It sort of works. It's enough to make my robot react correctly, but it's still not enough for it to stay upright for very long. It could also be the fact that I'm using a nunchuck held on by rubber bands, but I think it's a software problem.

Sadly, I hooked some things up wrong, and I messed up my Arduino. It still runs the last program uploaded (the fail balance one) but I can't program it anymore. Oh well. I plan to a) get an ISP programmer, b) replace the FTDI chip, or c) get a new Ardunio.

I'm sure I'll update this more, but it's late and I'm tired of typing, so here it is.

Wednesday, April 20, 2011

Completion: Mission Possible (P1)

(new format for titles, woo)

Anyways, here we are. Albeit it a bit late, I believe a completion post is required for our most labor intensive project: our Mission Possible device for Science Olympiad.

Quite literally, it is the most over-engineered, hand built, scientific, unreliable... 90 second timer.

Does a 90 second timer deserve all of those descriptors? You can decide that for yourself one you see the actual thing.

First, some information:

Time spent: ~168 hours
Cost: ~$150
Primary material: wood
Secondary material(s): LEGO, simple electronics, electric motors, screws, WIN
Primary purpose: Autonomously complete a sequence of tasks in a specific amount of time.

Design objectives:
Win Science Olympiad competition - FAIL
- Regional Competition - 3rd place
- State Competition - 12th place
Provide design and engineering education - WIN
Incorporate hand built mechanisms - WIN
Score the highest amount of points possible - WIN
- all highest point tasks completed
- longest time for sand timer running
- block stacking device win
- customized features (custom built fan, bottle, motor system)
Impress the Judges - WIN

Personally, I have to say I'm disappointed that we didn't get anything for our efforts, but in the end, I know that, with the amount of hard work we put into building this thing, we won that competition (we could have).

To follow in part 2: build pictures, maybe video links, task descriptions

Friday, March 18, 2011

[UPDATEUPDATEUPDATEUPDATE]

HEY YOU.

We've been working on several thousand projects. loljk. But we have done a lot of things.

So, I wanted to share about recent things that we have acomplished.

Here's a list of a few things we've done in between then and now.

- Science Olympiad (Two building things: Mission Possible and Wind Power)

Actually, before I continue, this brings up the topic of Mission Possible.


It was probably the most challenging/difficult/complex build that was completed from scratch.

We designed it. Built it. Tested it. And got 3rd place.

[oh yeah. blogging from the floor of my garage.]

But that has kept us pretty much preoccupied until now.

So there's not really much else going on because of SO and school.

Just a quick update.

Oh, we're planning on releasing the time lapses from our build sessions very soon. Like tomorrow. Now proclaimed as "Intersphere day", the 3rd Saturday of March.

So happy Intersphere eve!