Tuesday, 10 June 2014

Lego Web Bot

I built this little guy a while ago and just havn't had a chance to post it yet. Its a rover built using Lego mindstorms that has a place for an iPod touch to be put inside, and that iPod touch connects to a web site hosted by my laptop when I want to run this thing, and another iPod, or phone or computer or whatever connects to another webpage served by the laptop that has an input page on it.

The iPod in the robot is a 4th gen iPod touch with a tinkerbrick case put on it (of course I have a lego case on my iPod :))
 Here are a couple pictures of the rover, showing the general structure and how the iPod is mounted inside:
 The rover uses a light sensor to react to the webpage that the iPod is connected to changing colour; you can see the light sensor sitting between the motors in this pic.
 iPod placed inside:
 And locked down. Note the camera is visible for future use :)

 Both the lock button on the iPod and the USB port on the NXT brick are acessable from the top when the cover is lifted:
 And the NXT brick's charge port is avalible from the bottom:
This is a video showing an early version of the webpages that are served by the computer
And the final version of the webpage:
Once you have watched those, it will be a bit easier to explain what goes on, so far as I know anyway. My friend actually built the webpage and javascript that runs this whole thing, but here is how I understand that it works: The laptop uses node.js to serve two webpages over the local network, one an input page that has buttons that can be clicked with a mouse, or a finger on a touchscreen, as well as the wasd and arrow keys on the keyboard, and uses those inputs *insert internet server black magic that I have no idea what goes on here* to change the colour of another webpage in real time. So I simply set up my laptop, start the node.js server from a command prompt, and direct the iPods to the IP address of the laptop, plus /input or /output for the respective pages and go to town. It feels magical to me. Anyway, here is the video that you really want to see, the rover actually moving. Note that my camera is getting really really old, and the delays that you see between touching the button on the iPod, the rover moving, and the sound are all due to the camera. In reality, the control is almost instantanious.

Wednesday, 16 April 2014

The Window is finished! (Well, kinda)

On Friday night of last week, I came home to a nice box of goodies sitting on the table, my KK2.1.5 board, some connectors and a small prop balance stand, and after working a little bit on Saturday, Sunday and Monday, I ended up with a functioning octocopter. Here are a couple of pictures of it complete:
 Upside down:
 A closeup of the center:
 And a closeup of the camera mount:
I soldered up a big nasty wiring harness out of 14 gauge wire running up the arms to supply power to the two motors per arm, and some 12 gauge wire running to two XT60 connecters each to allow for a total of 4 batteries to be plugged in at any time. I mounted the electronics and batteries in an old Tupperware container which is screwed to the middle of the frame and which has a bunch of holes drilled thru it for running all the wires, and I mounted the KK board in its foam packaging as recommended by the hobbyking manual; this serves to protect the board, and isolate it from vibrations transfered thru the frame. I also had to extend the ESC wires using a bunch of extentions, splitters and ugly hacking, but it all connects up and works well. As you can see, at the moment I only have two batteries mounted, owing to the fact that I only have 3 un-bulgy LiPo batteries that I trust not to catch fire or explode, but there is room for two more in the container, I only need to drill some more holes for the wires to exit. To fly properly, this thing actually needs four 20C 2.2Ah batteries, not the two that I am currently running because each motor can draw a maximum of 18A of current, and I have 8 of them, roughly equaling 160A total current draw with all the motors maxed out, and right now with my two batteries, they can only deliver 2.2Ah times 20C, a little over 80A of current. Nonetheless, it still does fly, but the flight time is a disapointing 5 or so minutes, and I am not getting full lift (which I calculated to be 9kg with the motors running full out) While I am on the subject of lift and weight, the copter with no batteries weighs approximately 2.6kg, and four of the batteries I am using weigh together about .7kg, so once I get enough to actually fly with 4, the total weight of the octocopter will be less than 3.5kg, leaving quite a bit of payload capacity.
The camera is an Oregon Scientific "ATC mini" action cam that I got on amazon.com for $40; I used its "tripod adapter"mount and threaded a 1/4in bolt thru some pipe and a tee with half cut off, hose clamped to the frame as a mount. Its simple and sturdy, but transfers a lot of vibration to the camera, and that makes the footage, well, less than perfect. Lastly, I used some red, green, and black electrical tape to indicate orientation, the black stripes is the back side, green is right (starboard) and red is left (port). I have not yet played with the PI values that are tuneable on the KK board, and so while usable, the octocopter is not quite as stable as it should be. Still, the fact that it flies pretty good with stock settings is pretty awesome. I expect it to get much more stable when I properly tweak the PI settings and perhaps the altitude dampining.

So on to what everyone really cares about, the videos of it in action! The first two are good if you get bored quickly, they are short and you see it reletavely close up and doing cool stuff. The middle two are if you want to see a bit of a longer video, and were actually taken first, but they get a little boring. The last two are also slightly boring, they are the footage shot by the ATC mini mounted on the octocopter. Enjoy.
So that is all for now, next up will be getting some more batteries so it can actually get some decent flight time, and an underslung pan/tilt bracket for the camera with some landing gear to keep it out of the ground, and video feed back to the ground as well as a seperate tx/rx combo for someone else to film while I fly, and perhaps after that, AN AIRBORNE PAINTBALL GUN! awwwww yeahhhhhhh. A project is never really finished, but at least the beginning is finished :)

Tuesday, 8 April 2014

PKP (it's alive again)

In my last post about PK, I had completed the motor controller, but had not yet tested it, so I started off by getting out my UNO and writing some test control code for the motor controller:
I got the code all written up, and gave it a test with two multimeters hooked up to the outputs (Unfortunately this video is really dark, it looked lighter when I was taking it)
And hooked it all up and gave it a try (The motor directions are reversed in this video, I fixed that shortly after)
The code running on the UNO during all of these videos is as follows:

#define in1 3
#define pwm1 9
#define f1 5
#define b1 7
#define in2 4
#define pwm2 10
#define f2 6
#define b2 8
void setup()
  // Channel 1:
  // Channel 2:

void loop()
 int p1=pulseIn(in1,HIGH);
 int p2=pulseIn(in2,HIGH);
 int p3=p1+p2-1500;
 int p4=p1-p2+1500;
 p1 = constrain(p3, 1200, 1800);
 p2 = constrain(p4, 1200, 1800);
//============= Channel 1 =============
 if(p1 > 1530)
   int s1=map(p1, 1530, 1800, 255, 0);
 else if(p1 < 1470)
  int s1=map(p1, 1470, 1200, 255, 0);
//============ Channel 2 ==============
 if(p2 > 1530)
   int s2=map(p2, 1530, 1800, 255, 0);
 else if(p2 < 1470)
  int s2=map(p2, 1470, 1200, 255, 0);

For my actual outdoor run, in order to get some footage, I made up a quick little camera bracket for my transmitter, I call it the "forever alone camera mount"

And I also made a little mount for my action cam to mount on PK in place of the paintball gun, since I do not yet have the necessary parts to make it opperational yet.
And with all that set up and working, I went out and drove it around my driveway for a bit (woohoo, my first legitimate run :)) The first video is me filming, and the second is from PK's camera
Well, it works. After I finished driving it around, I stuck it in an outdoor shead, here are a couple op pics of the various parts, and the whole thing as it sits:
Motor controller:
 The whole backside:
 And from the front,
 And side:
Anyway, it runs, which brings a smile to my face :) Onward and upward!!

Monday, 31 March 2014

More Window

Just a little work done, but besides the electronics/battery box in the middle that I have yet to mount, this will probably be all the progress I make untill my KK2.1.5 board comes in the mail. Starting to look like an Octocopter...

Sunday, 30 March 2014

PKP (trials and tribulations of building a homebuilt motor controller, Pt. 2)

When I last posted about PK's motor controller, I had just let the magic smoke out of a MOSFET from a cheap cordless power drill, and ordered 8 of these 60V 30A MOSFETs from sparkfun. Well, a little while later I had a pretty little red box show up, and it was time to get started:
 Also on hand for this project, I had the heatsink from an old computer (already cut in half in this picture)
And the ever faithful relay part of my motor controller
I set to work on the heatsink, planning on drilling and taping 6 holes into it, and cutting it in half so each channel would have three MOSFETs wired in parallel. Well, the heatsink had other plans, and I ended up snapping not one, but two drillbits in seperate holes on the heatsink. At this point I decided that rather than try my luck with the other half of the heatsink and probably end up with the same fate, I would cut off the portions of each heatsink that were ruined, tap the holes, and hope that two MOSFETs in parallel would be enough. Here is a picture of the heatsinks that I ended up with:
I then soldered up a board with 4 MOSFETs plus all of the necessary connecting wires:
And put it all together:
Copious quantities of heat sink compound was used, and I put a cut up chunk of circuit board between the heatsinks to prevent them from shorting out on one another (MOSFETs are different than voltage regulators and the like in that the tab on them is not connected to ground, it is connected to the output, so it is important to isolate the channels from each other) The whole assembly is held together by a couple of zip ties (I love my zip ties :) )
I taped an unused computer fan to the top of the assembly, connected it to the relay block and...
Found out that the MOSFET driver board that I made for the last batch of MOSFETs was dead. So this is the second driver board I have built and then fried, and I am getting a little iritated, but I am this far in already, so I gotta keep going, so I broke out the multimeters, battery and electronics, and prototyped another one,
cut the disfunctional one off of the relay block driver,
and soldered up yet another board:
I (kinda, maybe) learned some lessons from the other two that I fried, and made this one completly removable using 0.1" male and female headers so that if it fries, I can swap in a new one without cutting any wires. I also doubled up on the transistors for each channel, hopefully giving a little bit of redundancy and added a header for the computer fan. I stuck it back on the motor controller and now have a fully functioning motor controller:
The male spade connector is for ground, power is supplied to one of the four relay terminals in the centre of the brick, the heat shrink tub covered two pin connector is both ground pins to be connected to the logic circuit, the four pins are for direction control, and the two left are speed control.
Here is a picture of it mounted on PK:
 The interesting thing about large robots such as PK is that, in contrast to smaller ones, it is not as important where things such as a motor controller or MCU is mounted, and it might change around a lot, so that is probably just a temporary resting place. That said, here are a couple more views of how PK is right now:
Due to not having a lot of time and the fact that my front yard is one big mud puddle while my back yard is still under a bunch of snow, I have not yet tried the motor controller on PK's motors yet, I just hope that the two MOSFETs per channel will stand up to the motors, cause if I let the magic smoke out of these, I might not have the motivation to rebuild the speed control part AGAIN, and I am a little on the broke side to buy a commercial speed controller. The paintball gun isn't quite operational yet, I still need to buy a right angle fitting for the remote line so that it will fit between the end of the gun and the main battery. That's all for now, I hope to try that motor controller out soon.