Sunday 28 October 2012

Wiring UP 2-3-2 and Drive System

After a few days ill in bed, I was really looking forward to getting a bit done once it cleared.  So yesterday I finished off the wiring for all the elements I have fitted but haven't yet sorted.  I then redid the custom shields as needed for the 2-3-2 and Master Arduino.  

I found that the frame upside down on the Rockler made a superb working area, I could spin the whole body to access the right bit. :)

I finished fitting the Feet and Dome Speed controllers and sorted all the wiring.  I have rewired the 2-3-2 system and added a new shield to help simplify the layout.  I also wired in the Master Arduino and all the connecting wires.




But while rewiring the 2-3-2 I realized I had disconnected it all without having documented the set-up.  So I now have the fun task of remapping all the pins in the code and making sure all the motors are driven in the right directions.  :)  But I thought that for next time a bit more documenting of the set-up would be good.  So here we go:







So once this lot is fully tested he will be doing the 2-3-2 and driving via the pad.  But lots of work to do before that.  But another step forward.

I still need to finish wiring up the 5v USB power supplies.  The hope is that running all the 5v low current stuff from USB Powerbanks will maximise the run time of the 12v supply.

Aiming to have it all working for the NEC, I would like to have the pad redone to use the other LCD too.  But driving and 2-3-2 is the main concern at the moment.

Just a shame it will only work for as long as the 7Ah SLA battery lasts.  But I cant justify the decent battery at the moment.  Will have to locate a 2nd SLA for the event. 


Saturday 20 October 2012

JAG Alu Centre Foot

This arrived too, the JAG Alu Centre foot. Forgot to post it. :)  It is really beautiful.  I'm going to wait to fit it, it might be in for CE2, but will test the current set-up to start.  Id love a set of alu outers too, but don't think they are very likely.  I just hope the thicker alu doesn't cause too many issues with my custom caster set-up, it's pretty tight on the steel one.


BHD 1.6 Teeces Code and Code URL

I finally got round to cleaning up the 1.6 code I used in the Dome light kit.  I fixed a few bugs and tweaked it here and there, so thought it worth uploading the finished code and making it available in a location that the latest could always be found.  I am sure it will keep getting tweaks.  I included 3 examples; 
1.  Simple Random logics PSIs and no HPs. Similar to the default code.
2.  All the script options in the loop as demo.  Similar to the video for 1.4.
3.  The last used version of my I2C control to better see how I triggered it to control all the HPs, PSIs and Logics.
I hope it should make it easier to figure out how it works, but I may need to go back and annotate it a little better.

I also collected up all the sketches I have got working so far for the Ard2-P2 controller and droid Arduinos, all libraries used and the XBee files.  All the Arduino use I2C in 1 direction to talk from master to end units.  There are 6 Arduino in the set-up so far:
1.  Pad end. Currently a Nano, but due to become a mini mega. Plus PS2 pad, Screen and Xbee.
2.  Droid master end.  Currently a mega but will swap to an Uno plus XBee Shield. Connects to Siren 10 and Sabertooth 2x25.
3.  MP3 Uno and Sparkfun MP3 shield.
4.  2-3-2 Uno. Connects to actuator pots and relays for 2-3-2 setup.
5.  Dome Servo Uno.  Connects to the signal lines of 12 servos
6.  Teeces Pro Micro.  All dome lights.
These are all pretty rough, not much annotation and what is there may be wrong.  But it all works, except the 2-3-2 code, that is yet to be tested.  But all WIP so may not be how it all works in the final incarnation, but will try and keep all major updates in new files in there from now on.  Will also start uploading things like the test sketch i used for the dome sensor.  Could be really useful for someone, and easier to follow than hidden in the main file. 

All the files are here:
Google Drive Folder

I have only been playing with the Arduino stuff for about 6 months or so, and hadn't coded at all for more than a decade, so this may not be done in the textbook manor, but it all works.  :)  And so far works well. 

The standard LCD arrived, so will have to try and get that up and running soon.  Fingers crossed on that one. Also started wiring the feet motors from the legs into the body.  Exciting times.  Just making a mount plate for the ESC, Master Arduino and the Slip Ring board and he will be almost ready to roll.

Wednesday 17 October 2012

Monday 15 October 2012

Dome drive is done.

Dome drive is done. :)  In the 1 stick mode the right stick drives the dome and then R1+R2 triggers and a face button allow dome drive scripts to be run, during which the dome drive via stick is disabled   So I have face forward, left, right and back, spin left, spin right, small shake, big shake, double spin, spin then spin back.  All possible.  Will write something into the Cantina script, maybe a slow spin on the short-circuit too.

I cant stop playing with the dome drive, great fun via stick and buttons, the more stuff moves the more I'm enjoying this building lark. :)

Hope to have a video for you Wednesday.

So next up is to repair the I2C lines I used in the dome, they were lose in the dome and got mangled, so need to test them and repair the dead ones. :)

Then its 2-3-2 time once more, but this time via remote. :)

Sunday 14 October 2012

Pad Crash Protection and Basic Dome Position Control

Well, a lot more pottering than solid building this weekend, but got a few useful bits done.

I have redone the code to reset the dome and feet drives if the serial on the droid end doesn't receive an update for 20 attempts in a row, should be about 0.4s, works fine.  Also ordered an LCD without the I2C (was only £8), it will use more pins but should work and might not have the same issue.  Either way I have pad end Arduino crash protection now. :)

So with that done i went back to the dome drive and the position control.  For the position I am using one of these:
https://www.sparkfun.com/products/8678
With a wiper attached to the dome baseplate (old pics):





For the drive I am using the A&A dome gear and a Pitman controlled by a Syren 10 connected to the droid maser Arduino as a servo.  I tried the serial control of the Syren, but couldn't control the ramping so ditched it for the VarSpeedServo library and I use the "slowmove" option.

The old code I had used microseconds, I have been finding degrees easier to work with, especially as this is speed so the accuracy doesn't matter too much.  So I scrapped all that and I rewrote the code to sense the position and then depending on distance apply a speed to the dome and keep doing so until position is reached, I added 4 ranges to apply different speeds at different spots to bring it to a smooth stop and not shoot off if close already.  Then added a variable buffer value that allows me to change the accuracy so that head shakes etc aren't fussy about the exact spot so just change direction and don't seek the spot.  The VarSpeedServo really helped to smooth it all.  There is no clunking and it changes direction really smoothly.  Much better than the clunky mess i had with the standard servo library set-up. 

I can spin the dome, or face in any direction quite happily now via script, so next job is to add it all to the main Droid Arduino and get it under pad control, both via the stick and via buttons to face forward or spin or shake or whatever.  Going really well.  Will need my cameraman soon for another video. :)

Friday 12 October 2012

Pad Freezing Issues

I have a problem with the I2C Screen freezing.  It locks up the Arduino and stops the pad working.  I can recreate it and if i do random commands to start it can work perfectly for hours.  It's very odd.

I think I must have tried a dozen or so libraries for the I2C display on the pad, and those that do display the text correctly have the same or worse issues.  Many simply didn't work at all, some required rebuilding the code, then didn't work.  So I'm pretty sure I have the best library for the job, but I don't have the skills to rebuild the library or to diagnose the issue any further.  It's so close to being perfect it makes it even more frustrating.  If you do random combos for the first half a dozen commands it then will allow any combo to be used and works flawlessly.  Its driving me mad!

I have rewritten the pad code a couple of times and managed to get the problems to change slightly, but nothing seems to solve it.  So I am convinced the code is fine and the library is to blame.  But I could still be wrong.  I had pinned my hopes on the Nano being the issue, but I swapped it for a mega tonight, and that has exactly the same problem, so it isn't RAM related, or related to the Arduino type. :(

The issue is either in the Wire or LiquidCrystal_I2C libraries, but the Arduino site link is dead for the latest library.


If I short the 2 I2C lines it causes exactly the same issue.


The good news is that it only freezes when the screen changes, so driving isn't an issue, only running the button presses.  But as I want to be able to run scripts while driving I need to find a way round it.


So I have decided to take a different approach.  I am going to persist with the current code, but add a button to reset the pad, and also add some code to the droid to stop it if it loses connection.  This combined with a shorter setup on the pad should mean its usable, and allow a little more faith that it wont run off and destroy stuff. :) 


But I will keep an eye out for updated libraries and see if I can solve it further down the line, and maybe look at alternative screen options and see if they are any better.   Its really disappointing, it's so close to an ideal solution.


So a very frustrating couple of evenings work, loads of effort and zero progress. :(

Thursday 11 October 2012

11/10/12 R2 Progress update

Well boys and girls, time has come to start a blog.  The build log on astromech.info was fine, but with a small member base it wasn't getting that many views, and for the effort it took it felt like it wasn't worth doing.  But i enjoyed writing it, and looking back at what had been done, so a blog that can be read by anyone has to be a better option. :)  I hope you enjoy it.

I wont redo all of the progress to this point,  but if you spot a job and want to know more about it, ask me and i will grab that element from the old build log and repost it here.  But for all the work up to this point the photos and videos are here:


The dome is built, the 2-3-2 is in and working, and the feet drives are fitted.  But nothing as yet has been final fitted.  I wanted to get the control sorted before finishing anything.  Here is a video of the 2-3-2 elements and the dome servos running from a button pad in the back of the droid.



I am currently working on the electronics and control.  The setup is all based around Arduino microprocessors.  I am using a PS2 controller, connected to an Arduino and an I2C 4x20 LCD screen, that then uses an Xbee to wirelessly connect to an Xbee and Arduino in the droid.


The Xbees are setup to pass the pad stick values and a script number from the pad to the droid, and to pass 5 digital IO lines from the droid to the pad.  The IO lines are used to read the states of the feet drives etc and  there is also a 'busy' line.

There seems to be an issue with the I2C display library, it causes the screen and pad to crash but only after the first 4 press combos, and only if certain combos are used, very strange.  I have found a new library that may solve the issues, but need to rebuild the code to be able to use it.

The Droid master uses I2C to communicate with 'End Unit' Arduinos.  So far i have control of the MP3s, Dome servos (9 doors and 3 Hps) and the Teeces v3 light kit running my custom code.  Here is the latest video of all the elements running together.


Next jobs will be to sort the Pad and make it as reliable as possible, Dome drive position control and then 2-3-2 and feet drive control.

More updates soon.