Wednesday, February 24, 2010

I'm going to start working with the .datalogger class this weekend. I've found time in my projects to get back to the PID balancer that is in my book. The settings were bad last time I tried, so I am going to give it another go and want a decent way to tune the variables. I could just putz around with them and eventually find the results, but I'd rather use the data logger to track the error signal and the output and see where we go from there. That way I can get a better handle on what is going wrong.

Aside from that the projects are going well. I'm going to start working with the Navigation class that allows you to use commands like .goto(x,y) to navigate a path. I'm not sure what I am going to do with that, and I have yet to figure out how I want to use that my course (unless I wait until next year, but where is the fun in that?). The topics I have left are circuits, magnetism and optics. Unless I find something to do with a vision camera, I don't know how I am going to fit the NXT in there to do anything more than my LabQuest can do. But when I get to mechanics again next year I think I will be well prepared to use the NXT a ton.

Thursday, February 18, 2010

Well, the DC power supply works, but is a bit faulty. I guess a duty cycle of 10 ms isn't fast enough to avoid small fluctuations in the multimeter reading. Also, when the the duty cycle is set to full bore it still doesn't get more than 5.5V out despite having 7.2V in the batteries. But whatever, I've got a 10 step (did I mention they weren't equal steps) DC power supply which is more options than I have with swapping battery packs.

The big success is finally getting Lego Digital Design to work properly. It took me a while, and I had to learn some techniques for getting around odd quirks of the program, but I was able to build my oscillator out of it. This is pretty handy since I am going to have to take those oscillators apart soon to continue on the PID controlled balance bot.

The most amazing thing about LDD is the instructions mode. Click on the button and it goes through and creates an .html file that will allow you to recreate your device. I'm sure this is not big news to Jeremy, but I find it awesome that they create a new build pattern based on what you have actually built in the model. It is pretty sweet.

Speaking of sweet . . . and sour. With the new release of Mass Effect 2 it seemed like a good time to go back and play Mass Effect (1) for the first time. I'm not in very far, but I am most impressed with the cinematic quality of the dialogue and camera work. I haven't gotten too in depth with the action parts of the game, but it has been really fun working through the dialogue trees. The way the system works is that you select where you want to try to push the conversation, and rather than everything changing immediately the selection you made just works its way into conversation. Meanwhile I'm also working my way through a second run-through of Fallout 3. This time I am evil melee fighter and am trying to pick up some of the last eight achievements left in the game. It has been pretty fun so far, but I'm having a very hard time going around being a dick all of the time. We'll see if this gets better.

Friday, February 12, 2010

I'm well past the point of being able to construct an oscillator out of an RCX in time for my lab. Just as well since the time to finish the lab is going faster than I thought. So that leaves me with a question of what the hell I'm going to do with the progress I've made (both with the NXT and the RCX). The utility of the NXT is in its sensors and it's mobility. While I have the interface to make it record things with Vernier sensors, I also have the LabQuests, which offer more options for analysis and less hassle to get data from. The NXT sensors are kind of crappy, aside from a compass and a sound intensity meter. The SIM might be useful, especially on a mobile device, to find hotspots and cold spots in a room. Maybe I can make a lab where you find the hot and cold spots?

The RCX looks like it will have more utility than I originally thought. The connectors are really easy to attach to alligator clips, and if I keep the PWM frequency high enough I can try to use it as a variable DC output for electricity labs. Still, programming it is proving to be more difficult due to lack of documentation and similarities/differences from the later versions of leJOS. Right now I'm trying to figure out how to use Sensor Listeners and while I can get one example to work it is still in the "magic" range of things where I can't dissect it and put it back together again.

Labels:

Wednesday, February 10, 2010

and Failure!! Well, not exactly. My original NXT project has worked beautifully and my lab is going off without a hitch . . . at least for those 2 setups. I was hoping that with the same amount of work I could get it running on an RCX. I didn't really think through the project much as I was on deadline for the lab. After spending a lot of time figuring out how to get leJOS on the RCX, and getting the IR Tower to work correctly I ran into a brick wall. That brick wall was in a method called .setPower(). The problem wasn't that there didn't exist a .setSpeed(), I was ready for that since the RCX motors don't have a tachometer built in. That's why I bought a rotation sensor. The problem was that .setPower() only operates on a range from 0-7 unlike .setSpeed() which works from 0-900 deg/sec. The power setting isn't even a linear relationship. After a lot of digging through different languages I couldn't find one that would give me the resolution that I'm looking for, so I'm left with creating my own Pulse Width Modulator. The RCX uses PWM already, but it is over an 8msec interval (thus the 0-7) power setting. I'll have to extend the width in order to make this work, and control the pulse manually. This means that the number of msec that I make the width is equal to my resolution for frequency control (which I still have to calculate and have indirect control of). But the wider I make the width the more difficult the problem becomes. If the width is too long then I can't just have the motor run hot for the duration and cold for the rest. If I want a duty cycle of 2% for a 100msec cycle then I should ideally run hot for 1msec, cold for 49msec then repeat. But that requires a more complicated algorithm that figures out the number of times to run hot for 1msec. It's not that I can't do it . . . it isn't going to be that difficult . . . but I'd rather just leave it as an easy "hot for x, cold for 100-x" system. Anyway, due to these problems I have bought one more NXT brick and will probably buy a new kit next year. Bummer, but at least I'm learning things.

Labels:

Friday, February 05, 2010

Success!!! My oscillator and program both work, and with a string at least 1m in length I can create the first few standing waves. All that means that I can go forward with the lab that I have. As always there is a catch and right now the catch is that I only have 2 working NXT bricks. I do have 2 RCX Bricks, but I haven't gone through the process of setting up leJOS for the RCX. I also would have to build a completely difference oscillator and Lego Digital Design doesn't seem to have the RCX parts built into the library. Maybe I'll have to go back to learning Bricksmith in order to make it work. Unfortunately I don't have any RCX bricks here at home and I don't know if I would want to try to get another version of leJOS running on my version of Eclipse. As it stands right now the law isn't going to be until Tuesday, so that gives me one day to figure all of this stuff out with the RCX or just bag the idea and only have 2 stations for my 4 groups. Whatever, I'll figure it out.

Oh, and I greatly improved upon the oscillator design. I currently has no idler gears and is easier to turn.

Labels:

Tuesday, February 02, 2010

I have had a certain amount of success building my Oscillator. Here's a picture. It is way too big, and needs lots of optimization. I have something like 3 idler gears in there for spacing, and I'm sure I can improve on that when I get to the next model. The whole size of the thing is too large and piece heavy. There is also an awkward height between the bottom support and the middle support (6 holes). While I will definitely improve upon the design the bulk is handy because when it gets going this thing walks a lot.

But the best part is that I added some basic code to the ButtonMath program I had before so that the motor is directly controlled by the buttons on the NXT. After adding a display showing the speed (or at least the speed setting) I now have a frequency controller that can alter the frequency of the oscillator. It still doesn't get high frequencies. The motor does even make it past 900 deg/s (and that is at full battery) and the gearing is 25:1. So at best I can make it up to 62.5 Hz. The next step is to find an elastic string and the right length/tension so that I can get a fundamental frequency in the 12.5 range so that I can see multiple standing waves.

I figured I would post the code just in case I forget how to code it at some point. It is poorly commented . . . but that is because I am a bad programmer.

//This program is designed to directly control the speed of the motor using buttons
//to set the variable MOTORSP. Pressing right adds 1 to the motor speed, pressing
//left subtracts one and pressing enter adds ten. Each time the screen rewrites
//the motor speed.
import lejos.nxt.Button;
import lejos.nxt.ButtonListener;
import lejos.nxt.LCD;
import lejos.nxt.Motor;


public class MotorControl {
static int MOTORSP = 100;
public static void main(String[] args) throws Exception {
LCD.drawInt(MOTORSP, 3, 7);
Button.RIGHT.addButtonListener(new ButtonListener() {
public void buttonPressed(Button b) {
LCD.clear();
MOTORSP += 1;
LCD.drawString("Motor Speed", 3, 6);
LCD.drawInt(MOTORSP, 3, 7);
Motor.A.setSpeed(MOTORSP);
}
public void buttonReleased(Button b){
}
});
Button.LEFT.addButtonListener(new ButtonListener() {
public void buttonPressed(Button b) {
LCD.clear();
MOTORSP -=1 ;
LCD.drawString("Motor Speed", 3, 6);
LCD.drawInt(MOTORSP, 3, 7);
Motor.A.setSpeed(MOTORSP);
}
public void buttonReleased(Button b){
}
});
Button.ENTER.addButtonListener(new ButtonListener() {
public void buttonPressed(Button b) {
LCD.clear();
MOTORSP += 10;
LCD.drawString("Motor Speed", 3, 6);
LCD.drawInt(MOTORSP, 3, 7);
Motor.A.setSpeed(MOTORSP);
}
public void buttonReleased(Button b){
}
});
Motor.A.forward();
Button.ESCAPE.waitForPressAndRelease();
}
}

Labels: