Monday 24 June 2013

Recoding EVERYTHING and rewiring the dome

Wow, knackered.  I had a 4 day weekend from Thurs-Sunday, so broke up from work on Wednesday and was looking forward to a productive R2 weekend.

I got my Adafruit I2C servo controllers back, made up a test sketch and mucked about with the new library that Graham Short (James’ dad) wrote for me.  He has done a superb job, it does exactly what I want.  Any Adafruit can be setup and addressed, from any Arduino on the I2C bus.  I have tested 2 arduinos on 2 adafruits, both running looped scripts, and as long as the Adafruit recieves commands from only one arduino at at time its fine.  Superb library, really brilliant and saves a lot of messing about.  I will post that once I get the go ahead, and have it running in the droid and fully tested to death. :)

So with the basic testing done, I mounted the Adafruit (0x41 address) in the dome and neatened all the servo wires, it looks so much better, but I did have to remake all my servo extensions, a bit of a painful job, but done now.   

Then while rewiring the Teeces I went to reconnect the USB (how it got power), and found there was no USB adapter on the board.  It was stuck to the end of the USB lead.  So one dead Pro Micro. :(  The new promicros have less space thanks to a different compiler, so I had no way to update my Teeces code.  So a decision had to be made.

After a bit of thought, I removed all the HP code from the Teeces BHD code, and that gave me loads of spare room, I added back in all the stuff I had recently changed due to lack of space and used one of the new promicros to run it.  So logics and PSIs back on. :)  But that left me with no HP LEDs, so I added all the HP LED control to the dome servo controller Arduino, but this time I added them as PWM, so I have a nice flicker and a strobe (more of a scroll from low to full brightness and back on a loop), really pleased with the change.  I just have a few combo scripts to rebuild now, but the base code works.  I have just used single LEDs for the HPs, I haven’t added the holo boards, think I will save them for R3, the single LEDs are fine.  Why anyone needs enough power to blind people is beyond me, seeing it’s on is all I need, I rarely run him in the dark, so lighting the room from the HPs isn’t needed. :P

So having sorted the HPs on the bench, I then had to rewire them in the dome.  I simply removed them from the PSIs and wired them back to the Servo controller Arduino (currently just a Mega I had spare), I intend to put all that code on either the dome bump controller or magic panel eventually.  The wiring was getting better and then worse again in stages.  So I looked at it objectively, and came to the conclusion that mounting the slip ring board to the baseplate was making it difficult.  So I removed it from the baseplate and mounted it to the dome, so all the wires are now fixed and don’t need disconnecting to get the base off, it also acts as an I2C bus.  With that mounted I managed to get the internals of the dome looking better than ever before. :D




The wiring stands clear of the servo arms for a short section.

Adafruit All wired up.

Mega (was spare, uno would do same job), with 3 PWM HPs and I2C connected.

Then I was looking at the cheat sheet and the commands spread sheet and decided I haven’t got enough command space, especially with more gadgets planned.  So I decided to add the 4 sets of 3 triggers pressed. E.g. L1+L2+R1 (Not R2) and a button.  And moved a lot of the functionality about to better use the sets that are easily accessed (single triggers).  So I finished off my spreadsheet of all the newly configured layout and new options, and set about redoing the code.  I started with the Pad, then the Master, then Teeces, Dome Servos, Body, MP3 and 2-3-2 controllers and now I have 193 commands (up from 145).  Basically I rewrote the lot, I edited the way things work to be simpler, added logic to turn elements on and off (2-3-2 controller and Dome position pot), and I annotated all the code better and also made a lot of changes for the better to help standardize the code.

I have a few bits to finish off and polish, i need to mount the body Adafruit and DC converter and connect the servos, then I need to load up and retest all the options and make sure it is reliable and safe to use.  Should be ok, most issues will be human error, I am pretty sure the concepts and methods are fine.  But it is at least a few nights testing.  I am a lot closer to a write up thanks to those changes. :)

So to sum up, ALL the code has been re-written for all Arduino to increase the number of options.  The HPs are now PWM controlled.  The dome has been completely rewired and neatened and now uses the Adafruit for the servos.  I have a day or 2 more coding to add a slow Mexican wave and a few new sound files etc and add the HP LED timings to the combo scripts (was easier when running on the teeces), and a couple of lights demos that will be a good way to show off quickly.  Also added the secret script.  Hope that CE2 will like that new one.

The dome redo has highlighted the slip ring again.  I think I will eventually move the Dome Pot to be on the dome and the wiper on the droid (flip the current setup) and mount the slip ring to the dome not the droid.  It will mean I need one for each dome, but the benefits outweigh the pain of buying one for each dome and of passing it up into the dome to connect it.

Once the testing is done I will upload the code to my drive.

Oh and I got the new pad battery and a few other little bits, so just need the new screen now and I can start Pad Mk2 :)

Then i get in tonight and my brother arrives with a cutting list for the Mancave!  5.5mx3.5m internal space, double glazing, insulated, well excited.  Hope to start on the frame in the next week or 2. :)  Im gonna be dangerous once i get a workbench and some space. :)

It has been a top R2 week.

1 comment:

  1. With all that space in that dome, surely it can't do very much :P

    Great job dude :) Looks very tidy. Mines messier and does next to nothing!

    ReplyDelete