TaW: Week 4 – RepRap Controller Board

I’ve been working on this for over a week and to be honest, failing.  The driver boards I soldered at the Hackspace were a breeze and despite having the same soldering iron at home now I’m really struggling.  I’m going to head to the space on Wednesday for open hack night, take my kit and ask if anyone can point out where I’m going wrong.

This Thing isn’t finished yet but it’s important to acknowledge issues like this, I’ll update the post once I’ve figured out what I’m doing wrong along with how I improved matters.  In the mean time I’ll start on Week 5 in parallel to try and make up for lost time.  No idea what week 5 will be, it likely wont require soldering though…

TaW: Week 3 – Dual Stepper Motor Controllers

After a trip to the Reading Hackspace and a few hours with one of the excellent soldering irons they have I’ve made short work of the two dual stepper motor controllers for my 3d printer.  The only components missing are the drivers which are ESD sensitive so I’m fitting once the main controller board is complete and all three boards are ready to be fit to the printer.

Week 3 - Dual Stepper Motor Controllers

Next up, the main controller board.

Controlling an RC Car with an Xbox 360 Controller via a Netduino

Update: I’ve posted a new project, Controlling a Syma S107G Using an Xbox 360 Controller that you may be more interested in. 🙂

This is a project I’ve had in mind for a while to get me back into coding on the Netduino again, it’s fairly simple but covers some important topics and can be scaled up for bigger projects.

WP_000614

As the title suggests the idea is to use an Xbox 360 controller to control an RC car.  I’ve wanted to do this for a while as the Xbox 360 controller is a wonderful piece of kit and ideal for various projects including robotics control.  I’m thinking of getting a little RC helicopter and performing the same hack.  I’ve a T-Rex SE 450 but I think I’ll carry on with my Futaba for that. Smile with tongue out

The title may be accurate but can also be a little misleading as you’ll still need a PC to act as an interface.  My idea is to build a PC based robot at some point so for me this isn’t an issue.  The data flow is as follows;

Xbox 360 Controller –> Wireless Gaming Receiver –> PC –> Netduino –> RC Car Remote

On the PC I have a simple .NET Windows Forms application which listens for an Xbox gamepad on “Player One” and it communicates with the Netduino using serial.  To control the car itself I wired up four of the Netduino digital pins to the relevant pads on the PCB of the RC controller itself to mimic the switches.  For debugging I added an LED for each direction to get the code working before I connected the PCB.  The RC controller itself ran on two AA batteries so I used the 3v3 output on the Netduino to power it.

WP_000622

WP_000621

Code cab be found at the link below so people can learn from it and for my own reference, I’ll likely forget how to do this again at some point!
Netduino Serial Example

Video of the whole thing working below;


Controlling an RC Car with an Xbox Controller from Jason Neave on Vimeo.
At some point I’m going to hack my old Roomba with something similar as this, it’s an Original model so doesn’t have a serial port though which makes things more complicated but it wouldn’t be fun if it was too easy.

Update:  Adding a closer photo of the connections between RC remote and the Netduino.  Set the pin high to imitate a button press on the RC controller;

 

Netduino Quadcopter

In my first post last year I stated that my New Years resolution was to build more stuff, the Jukebox lights are wired up and that project is more or less done.  One of my other ambitions mentioned was to design and build a UAV.

Now, I’m a Microsoft guy.  It’s what I know and do for a living so I know thier developer stack pretty well so upon learning of the Netduino a plan came together and this years project was born!  So far I’ve the Netduino, a Razor 9 DOF sensor board and a plan!  I’ve been following other similar projects such as Aeroquad and I plan to blog the project as I go.

The plan is currently fluid, I’ve not built anything like this before though have flown model helicopters before.  I’ve a few specifications that the copter will be built around;

  1. Autonomy – With the sensors onboard, the IMU and GPS, it will need to be able to fly a set path.
  2. Payload – Along with flying a path the copter will have a camera or two to capture aerial photographs.  Ideally from multiple angles to have some fun with Photosynth
  3. Telemetry – The copter will have a live telemetry link back to a PC and on board storage for later review of flight data.  Ideally a live video feed too which will be the stretch goal.
  4. Easy Mode – As with the Aeroquad I’d like my copter to have stable and agile settings, I wan’t my friends to be able to fly this easily with minimal practice.

I’ve set myself quite a challenge though as with all my projects it should be a hell of a lot of fun and quite a challenge.  Stay tuned for more…

Jukebox, Illuminated

I’m not finished yet however the lights are in the Jukebox and I thought I’d post a pic of a test I performed by hardwiring the lights to be green;

Let there be light!

It’s the first time since I’ve owned the Jukebox that it has been lit up like this, not long after buying it I tried with EL wire but frankly it looked terrible.  The outer band used to be transparent, for those interested I used a glass etching spray to give it that frosted look and to diffuse the light.  It looks far better in person that this picture would suggest.

I’m currently working on finalising the circuitry to control them as well as the code to control the colour from the PC.  I’ve been mostly successful with my prototypes but there are a few bugs to iron out yet.

Still, the wiring for the lights was by far the biggest hurdle so should be quicker progress from now on.

Keegan

Jukebox Lights: Serial Comms Prototype

I’ve just finished a working prototype for the Jukebox lighting control, doesn’t look like much at the minute but with the right RGB LED driver in place (I’m thinking three logic level MOSFETs may do the job) then this project is only a wiring job and a glue gun away from installation!  The C# code sends RGB as a percentage along with a value for brightness, also a percentage.  So, to get the brightest red colour send redByte and brightness as 100 and the rest as 0.  Mix, match and repeat.

I played with the colour picker control, some conversion is required though I gave up on the idea as PC RGB and LED RGB don’t match up quite the same.  My method works and is good enough for me.  The Arduino code uses a switch case for the incoming command, colour changing is “101” and I’m planning on adding others along the road.  Maybe a default dimmer for when video is playing and so on…  Time will tell.

image IMAG0155

This is a combo of two programs, the code on the Arduino and a C# program sending control signals from the PC via serial.  Code snippets for both are below;

Arduino

//      Pin Assignments
int rPin = 9;
int gPin = 10;
int bPin = 11;
int potPin = 0;

//      Global Variables
float red = 0;
float green = 0;
float blue = 0;
float brightness = 0;
int command;

void setup()
{
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{
while (Serial.available() > 0)
{
command = Serial.read();
switch (command)      //  Planning ahead for multiple commands to be sent, add another case for others
{
case 101:
red = Serial.read();
green = Serial.read();
blue = Serial.read();
brightness = Serial.read();
//  Code for debugging Serial
Serial.print(“Colour – “);
Serial.print(“Red: “); Serial.print(red); Serial.println();
Serial.print(“Green: “); Serial.print(green); Serial.println();
Serial.print(“Blue: “); Serial.print(blue); Serial.println();
Serial.print(“Brightness: “); Serial.print(brightness); Serial.println();
Serial.println(red / 100);
red = (255 * (red / 100)) * (brightness / 100);
Serial.println(brightness / 100);
green = (255 * (green / 100)) * (brightness / 100);
blue = (255 * (blue / 100)) * (brightness / 100);
break;
}
}
analogWrite(rPin, red);
analogWrite(gPin, green);
analogWrite(bPin, blue);
delay(75);
}

 

C# Code (SendData and Print only)

private void SendData()
{
byte cmdByte, redByte, blueByte, greenByte, brightByte = 0;
byte[] command = new byte[5];

cmdByte = Convert.ToByte(101);
redByte = Convert.ToByte(nudRed.Value);
greenByte = Convert.ToByte(nudGreen.Value);
blueByte = Convert.ToByte(nudBlue.Value);
brightByte = Convert.ToByte(nudBrightness.Value);

command[0] = cmdByte;
command[1] = redByte;
command[2] = greenByte;
command[3] = blueByte;
command[4] = brightByte;

try
{
prtSerial.Write(command, 0, 5);
}
catch
{
MessageBox.Show(“He no work!”);
}
}

private void btnPrint_Click(object sender, EventArgs e)
{
lbInc.Items.Clear();
try
{
if (prtSerial.BytesToRead == 0)
lbInc.Items.Add(“No Data”);

while (prtSerial.BytesToRead > 0)
{
lbInc.Items.Add(prtSerial.ReadLine());
}
}
catch
{
// do nothing
}
}

I’m hoping to have the driver built next week and hopefully the lights installed this coming weekend.  With the weather as it is it all depends on when I get get the parts delivered.  Next up is the Media Centre add-in to control the lights.  Should be a matter of UI code though as C# is a supported language for MC SDK.

Keegan