Got home from work yesterday and promptly drove the wheelchair over beside the kitchen table and loaded it up with my laptop, oscilloscope, couple multimeters, notepad and all the other random stuff you need for a bit of hardware hacking:
I don't have any proper oscilloscope probes, so I just cut a BNC patch cable in half and then soldered a couple twisted pairs from a CAT5 cable to the ends. I'm not using them for any really sensitive low voltage applications or high frequency stuff so no sheilding and whatnot is totally fine.In my previous research I found a couple of sites that have the pinout and some other data on either the joystick that came with the wheelchair, so figuring out which wires are what was pretty easy. (Ill post a list of the links I found helpful in my wanderings at the end of this post) I hooked one of the two outputs from both the X and Y axes to the oscilloscope and flicked her on:
I didn't want to just put both inputs from each channel together on the same output from the DAC because I assumed (and read elsewhere on the net) that the control board has some logic that detects that and locks out. So all I did was connect the DAC output to the anode of two diodes, and one channel to each of the cathode. Aside from the voltage drop across the diodes that made me run thru the whole process of connecting the scope up and matching the signals again, this has been working perfectly and only requires me use one DAC for steering and one for throttle.
Here it is all connected and spread out on the table:
And transfered over to the top of the chair:
Because I didn't want over a hundred pounds of metal and plastic putting a hole in my house from going haywire, I gave it a quick test with the clutches disengaged on the chair:
Tidied the wiring sitting on the top of the wheelchair up a bit:
And heres a closeup of the electronics that make it run. The UNO clone provides power is connected over I2C to the two DACs on the right side of the breadboard. Those provide the voltage out, which is fed over the brown and white twisted pair to the other side of the board, thru the diodes and to the wheelchair control box. The ribbon cable out the bottom goes to the wheelchair box and the wires coming out the top go to the joystick.Since I got it all working and controlled by an RC transmitter, the next logical thing to do was tie down strap my snowboard onto the top of the chair and go for a rip around the neighbourhood.
PS:
Realized after I published this post I said I would post all the useful links that I have found. Well here they are:
This one to a Stackexchange page asking pretty well what I want to know
This 2 page forum post that the Stackexchange post gets its info from
This interesting instructables post
This page from the manufacter of the joystick that shows you how to enter calibration mode
Product page for the DACs that I am using
And last but not least Adafruit's awesome tutorial with library for the DACs
One last thing. Here is a copy and paste of the code I have running right now on the arduino:
#include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 steeringout;
Adafruit_MCP4725 speedout;
int speedin;
int steeringin;
void setup(void)
{
pinMode(5, INPUT);
pinMode(6, INPUT);
Serial.begin(9600);
steeringout.begin(0x62);
speedout.begin(0x63);
}
void loop(void)
{
steeringin = pulseIn(5, HIGH, 25000);
speedin = pulseIn(6, HIGH, 25000);
speedin = map(speedin,1035,1875,1310,3522);
steeringin = map(steeringin,1035,1875,1310,3522);
Serial.print(speedin);
Serial.print(" ");
Serial.println(steeringin);
speedout.setVoltage(speedin, false);
steeringout.setVoltage(steeringin, false);
delay(1);
}
Thats it, thats all folks!
No comments:
Post a Comment