Saturday, 8 June 2013

Vegas Pack - RGB LEDs in LDP and Coin Slots

Having done a few events now, and spent most of my time playing with the kids, I feel R2 needs more fun factor.

I have been thinking of adding a Larson Scanner to the LDP for ages.  So he can do Kitt and Cylon impression. :)  But I didn't want only red LEDs.  So I was looking at RGB options, but for an estimated 15 LEDs that would be 3 pins per LED, or use PWM shields or even custom PCBs.  It was becoming a pain to implement.  I also wanted to do a similar thing with the coin slots.

Then I happened upon WS2801 chip based LED Pixels from eBay, they are £16 for 25, full range RGB and all addressable.  So I ordered a set.  :)

To fill the Coin Slots I needed 12 LEDs, 2 for each slot, leaving 13 for the LDP.  The spacing was almost perfect. :)

So I coded up a few modes and had a play.   :)  In person it looks great, really pleased.  And it can be as showy or as subtle as needed.

I have 6 modes for the LDP; Off, On, Fill from Center (outer 2 at half brightness), Kitt (Move 3 LEDs back and forth, 3 brightness levels on the LEDs brightest on leading edge), Cylon (4 LEDs back and forth with the outer 2 at half brightness) and flash between 2 colours. For the coin slots i have 7, Off, On, Fill from top, Kitt (move 1 pair up and down) Random Single colour, Random random colour, Alternate row colour and swap. All the timings can be adjusted on all the sweeps etc, and i can set the number of random calls on the random modes. All the modes use 2 colours so i can swipe red over blue for example, and both those colours and the modes can be triggered from the pad at any time.   I can manually change the direction of all modes that use it at any time too. :)  Useful for things like a Kitt Voice box simulator.

I will try and add these to a few custom scripts, id like to add a Kitt sound or 2, and the Cylon noise.  But might add Coin Slot effects during the Leia message or short circuit.

Currently they run as 1 chain, but I have decided to run them as 2, this will allow anyone wanting to copy the idea just the elements they choose.  Currently the LDP is 0-12 and CS is 13-24 so you cannot run just the coin slots.   I will edit that before uploading the code.

Surprisingly it fits in the droid.  I did have to remove one of the dome motor supports, and I do need to move the 5v DC converter for the body and the controller for the CBI/Servos, but I may look at running all on 1 arduino for the body.  It won’t be that busy most of the time.  So All body functionality, CBI, Vegas Pack, Body Adafruit servo controller.  But coin slots can only be seen when on, and the LDP looks fine, but i am considering putting the LDP set behind a dark lens to make it look more discrete, or a white diffuser, But for now it's sound as it is. 

I will upload the code when i have combined and tested in the fully assembled body.  Shouldn't be too bad to combine it. :) 

Ard2-P2 Code Updates:

I have been looking around and doing some reading, i kept reading that strings and arduino aren't great together.  Over half my pad code is strings, so time to try something different.  It will no longer tell you what you pressed, only that a command has been sent and it is running.  The up side is that the pad end will now run on a smaller controller again, so may look at the layout one more time. :)  It might stop that crashing, you never know. 

With that done, i then changed the 1/2 Stick drive mode status line to be a 2/3 leg mode status line.  The 1/2 stick mode command still works but no longer displays on the screen.

I then added a feed line from the 2-3-2 controller to the master in the code (the wires have been installed for a while, there are 3 in total), i made sure that the boot of the 2-3-2 and any leg mode change changes the digital output state, and that is read by the master on boot up and after any button press is actioned.  This line on the pad is connected via the internal pull up, and needs to be low for 2 leg mode, so with no 2-3-2 controller, it defaults to 3 leg mode. :)

I also made a start on some of the User Friendly mods, the variables for the fast/slow and 2 leg speeds are now all int he one place and easier to change, and i started some annotations to make it easier to understand.

Once i finish and test this latest batch i will upload it all as a new version with all the units and the most recent updates for each.

So combine the body code next, split the string of pixels, and then next up is the motion of the feet on the 2-3-2 and Walk scripts.

Fingers crossed.

No comments:

Post a Comment