Dec 042015
 

11934535_10156061505195316_3190924556943319116_oIts been a long time since an update, but we moved house at the start of the year and things have been hectic. At least, thats my excuse and I’m sticking to it! I have been making progress with R2 in the last couple of months, doing a lot of work on his brain for starters, and painting various parts.

Code wise, there has been a couple of fairly drastic rewrites since my last update. The interface is a REST API, which sends commands to various modules as before. I’ve added a scripting module now, so that scripts or loops can be initiated such as random sounds, or a dance routine. The servo module had to have a major rewrite too as I discovered that I could only control one servo at once and had to wait for that to finish before another command could be sent. That wasn’t much good! I’ve also written the first of the actual controller interfaces (not counting a simple web one for testing), R2 can now be controlled from a PS3 controller. Button combos are read in from a csv file to trigger certain effects or scripts. Lastly, R2 now has a voice, and can play any mp3 stored in a directory, including selecting random ones from a list of types. Next step is to get either the Pi or the A la mode Arduino to control the speed controllers. I don’t want to run them off the Adafruit i2c servo controller for safety, I’d rather drive them directly and have some form of watchdog to make sure R2 doesn’t go on a rampage. All the code is still available on GitHub under my user, dpoulson

The PDU also needed a rethink, not least of all because of the amount of current it needed. The setup now has feeds directly to the speed controllers, with relays on the output from them to the motors so I can break the circuit if needs be. These relays will automatically turn off if the battery is disconnected so that any pushing of R2 will not feedback into the speed controllers and fry them. The relays will also be controlled from GPIO pins on the Raspberry Pi so I can disconnect them via an API call. I’ll also have an input for a kill switch that will have to be permanently on if any of the motors are to be powered, possibly using a transmitter in a replica droid caller or hilt of a light saber. I’ve a base idea for the new relay controls:

Powerswitch The relays I’ve found are Omron G4A-1EA, which have the benefit of the switched load being on spade connectors on the top, rather than through PCB traces, which when I did the calculations would need to be massive to support the potential current running through them. This allows me to make a simple PCB with the controller circuit, and hook the 24V battery up to it to power the coils. If the battery is removed, the coils turn off and the circuits are broken. No fried speed controllers.

The 24V connection will probably go through the fuse box I’ve installed, with a hefty fuse. The makers of the speed controllers don’t actually recommend a fuse but I’ve seen a few comments saying a 60+A fuse can’t be a bad idea, just in case!

The battery will connect directly to the center contacts of a DPDT switch, with the fuse box on one side, and the charger connection on the other. This will allow charging the batteries without taking them out of the droid. Not sure if this is best practice or not, needs more research. Currently they are just a pair of 12V SLA batteries that I had, connected in series to give the full 24V.

I’m hoping to get some time either this weekend or next, to hook up the motors, speed controllers, and battery, to test them out and get an idea of potential current draw. They’ll be controlled with a standard RC transmitter/receiver for now. If I can get the legs onto R2 he may even be drivable by xmas.

Fingers crossed!

Mar 302014
 
Finally got round to cutting some holes into R2's dome. He now has lights! :)

So, finally got some time on a weekend with nice weather to get outside with the inner dome and my Dremel. Whilst the dome set I got had a laser cut outer dome, the inner one was totally uncut. The aluminium domes come as an inner and outer to allow you to have the indent around each of the panels, and also lets you have a nice lip if you have the panels opening, which is something I want. Of course, this means lots of holes to cut. Any panels that are going to open have to be cut out, as well as all the holes for the lights and holo projectors (HP).

IMG_0182To start off with, all the holes were marked using the laser cut outer dome as a template. HP and light holes were to be the same size as the outer ones, but the opening panels need more of a lip. A tip I learnt from reading other builder’s logs was to use a large washer, and to put the marker pen in the center, then roll it around the edge of the opening. This gives you pretty much a perfect size for the lip. Next comes the scary part.

Cutting disc grave yard. They really don't last long, and some of the shattered. The larger ones broke in the center so were unusable.Cutting the dome! These things aren’t exactly cheap, and even worse they’re quite hard to come by, having to wait for runs to be done of them by the guys in the states. But, its got to be done so I got the Dremel and a whole bunch of fibreglass reinforced cutting discs for it. I needed a lot as the wear down extremely quickly. I went through over two dozen of them just on the dome. Thankfully I got plenty.

I found the easiest way to do it neatly was to do the large part of the cutting with the dremel, at least enough to make a cut a few cm long so that I could get the hacksaw into the hole. The hacksaw made a much cleaner cut with more control. The Dremel had a habit of biting in and running off a bit, which made some of the fine cuts a bit difficult. By far the hardest bits to do were the circles for which I ended up making a load of straight cuts through the center to form a star pattern, then gradually cut each of the prongs off. Once I had the main parts cut I attached all the cuts with a large file to take it to the lines I had drawn.

All the pie panels done now, along with the top HP. The metal on the spun domes is a fair bit thicker at the top. Just needs a load of filing and sanding to make smooth and safe.It took a good few hours to get through everything, but it was worth it. The holes are still a little rough and still need some sanding down with wet and dry. Also the circular holes all need to be made a little bigger. They were originally marked up to be the same size as the outer dome holes, but ideally they need to be at least a few mm bigger, especially the HPs. Another tip that I’ve found on the net is using a glass wine bottle to help with the sanding of the circular holes. Wrapping some wet and dry around the neck, you can sand in a circular motion to get an even hole.

Still left to do are the rear PSI holes, in both the inner and outer domes. It is the one outer hole that wasn’t pre-cut, so I need to be extra careful with the outer part. The current run of laser cut domes are a lot nicer, with the inner and outer ones laser cut and all just about ready to just polish and paint. Also, I think I’ve been fairly lucky with this dome, as a lot of people report having to cut the inner dome in half to get the inner and outer to fit together properly.

Finally got round to cutting some holes into R2's dome. He now has lights! :)Once the last PSI holes are cut I’ll be ready to bind the two domes together permanently, which is another scary one way step. I’m making sure I’ve as much done with them separate as possible to avoid damaging the outer dome with a slip of the Dremel. I still couldn’t resist having a test fit of the two domes and inserting some of the lighting. It looks pretty good.

Next main steps once its all bonded is to install the main radar eye which I’m hoping to bolt on to make it removable, and then I have to source a load of hinges which seem to be either very expensive, or hard to find.

All in all, a good weekend of work. I would’ve like to do more but due to losing an hour due to the clocks changing, an early morning call from work, and Mother’s Day, I didn’t have much time on the Sunday to do much. Fingers crossed for nice weather again next week to finish off the Dremel work outside. I might also make a start on the skins too.

 

Mar 132014
 
IMG_0422_CR2_embedded

So, I seem to be building R2 in the reverse of how most people build their versions. Whilst I started with the dome due to finding a good deal, I’ve spent most of my time working on his internals and very little on the actual physical droid. Since my last post back in August regarding R2’s brain, I’ve done a lot of work on how everything will tie together to do the control. My current working idea is to have an i2c bus running throughout as R2’s central nervous system both sending out commands, and receiving feedback.R2D2_Electronics_Block_Diagram

The main control is still going to be a Raspberry Pi as this gives me much more range to do some interesting things later such as voice recognition, as well as letting me experiment with lots of different ways to actually control R2. I’m still thinking of using a PS3 controller as input, but also thinking of using a wii nunchuck is possible as a much smaller one to control simple operations.

The Pi will be linked via i2c to the various modules such as the servo controllers mentioned in my last post, with one in the dome and one in the body, and also to the lighting systems with Arduinos programmed to receive the signals to trigger various effects. I’m using BHD‘s Arduino code for the TeeCees lights in the dome at the moment, with just minor changes to accept the i2c signals. I may write something at a later date to do more dynamic light displays such as free form text messages to scroll across the RLD, but for now this is more than adequate.

Communication between the spinning dome and body will be through a 6 wire slip ring connector. 2 wires will be enough for the data signal, and then I will pair up the others to provide the power. I’ll probably have to go for two separate 5V supplies to the dome, one for electronics and one for servos as there will more than likely be a lot of noise coming over the servo power lines as they move.

PDUPower for all the electronics will come from a simple USB battery pack, which in turn will be plugged into the power distribution board I have designed. The PDU will take in a raw input from the sealed lead acid battery (or batteries) and produce clean 5v and 12v outputs, as well as a raw output direct to the speed controllers. The PDU also incorporates a few other features such as connectors for volt/amp meters that will be behind a panel on the front of R2, a voltage divider to allow the charge bay lights to function as a crude charge display for the batteries, and also a relay cut off for recharging R2. The last means that I can safely plug R2 into the charger (via an XLR connector), which will pull power going to the rest of the circuits. Lastly, there is the main power switch to kill power from the battery. There is a diode across the switch however which should allow any charge coming from the speed controllers to go back into the battery. This is a feature of the speed controllers to allow regenerative breaking.

The clean 12v will be used to power the audio amplifier. What is R2 without a few beeps and whistles?

I’m just waiting on the PCBs to come back from OSHPark, so I can try them out. Hopefully I managed to get most of it right and I haven’t seriously miscalculated the current draw from the batteries. I don’t want any tracks melting off the board!

Code wise, I’ve done quite a drastic rewrite of the controlling software to make it much more object oriented. Each different module (servos, audio, lights, etc.) is a module with a command keyword associated with it. This means adding new modules (LCD screen, extra lighting, drinks dispenser…) should be easy and just a case of creating a config file and possibly a class file if its a new type of module. All the code is available at github, along with the schematics and board diagrams of the PDU. The PDU is also available to get direct from OSHPark.

Fingers crossed I may be getting a few parts to build the actual droid with soon, including the feet, which means I now have to figure out a drive system for him. Mechanics isn’t exactly my strong suit, so should be interesting. :)

Feb 202014
 

Ok, so along with my R2, a side project is something that will hopefully fit inside of R2 and make him even more popular. To reprise his role in Return of the Jedi he will be serving drinks, and not just glasses from a fancy tray bolted to his shoulders. He will be able to mix a drink for you and dispense it into your glass.

The idea is, to have a bunch of reservoirs in a caddy inside R2’s main body, with pipes to an automatic arm that will open a door and raise, allowing you to put your drink under it. My design so far allows for five bottles, with peristaltic pumps from adafruit (via a UK reseller, Phenoptix), some L293D motor drivers, a TLC5940 PWM driver, and an Arduino Pro mini. I still have a long way to go on the design, but I have managed to the main module constructed and the pumps installed. I’ve also got a first revision of the circuit schematic worked out, along with a PCB layout that I’ve ordered from OSHPark.

Pumps

A closeup of the pumps

The main unit is made from a series of laser cut acrylic sheets, with a central threaded rod as the main shaft. The bottle tops still need holes for the tubing to go into, and the lids will be glued to the acrylic. Refilling will be done by removing the bottom plate and unscrewing the bottles. I also need to figure out ideas to check for the fluid level so I get notified when a bottle is nearly empty.

The main control for selecting the drinks will be handled by a Raspberry Pi, talking over i2c to the arduino to control the motors. This will allow me to do an embedded web server for selecting the drinks, depending on what options are available. R2 will also have most of his communication done over i2c which will allow the drinks dispenser tie into that and control the door and dispensing arm. Other future ideas are also having a few spare bottles and QR codes as labels on them so that I can automatically scan them in so that the Pi knows what drinks are available rather than having to key the data in manually.

Main unit

The main unit.

This is my first attempt at doing an actual useful PCB. Probably many errors and will need another couple of revisions, but it is a start. The Schematics and other files can be found on github here:

https://github.com/dpoulson/drinks_dispenser

And if you’re really bored and have money burning a hole in your pocket, then the latest revision of the PCB can be bought at OSHPark:

http://oshpark.com/profiles/DarrenP

Aug 092013
 
IMG_0136_CR2_embedded

Alright, so maybe a bit of a corny title, but I couldn’t resist.

So, at the end of May we had a trip to Milton Keynes for Collectomania. Besides meeting and getting autographs from Robert Llewellyn and Chris Judge, the other highlight was all the R2d2 droids that were running around. There was a whole collection of different astromech droids in varying states of the build process. Once I got home, and of course mentioned it to she who must be obeyed, I started looking at just how difficult these things were to build.

Initially I joined the main R2 builders club, which also has a yahoo group with lots of useful files and blueprints.The benefit of building an R2 over most other large props is the fact that there is such a large community of people who have already found most of the pitfalls. They also do runs of parts that might be beyond another builder’s skills or too expensive to produce in single units. Unfortunately, most of the talk and production is very America centric, but thankfully there is a very active UK builders group which I quickly signed up for.

After a few weeks of reading (and more reading) the forums I decided I would take the plunge. Mostly I will be keeping a picture log on Facebook and Google+, but will also write up occasionally on here.

I thought I’d first start with what I know, electronics. There are a set of PCBs available that handle all the dome lighting and runs from a single Arduino Pro Micro which gives a lot of power and flexibility. So, with the PCBs ordered, I jumped to eBay to get the rest of the components. Obviously, a lot of LEDs were needed so they were first, I needed a pro micro to run the system, and the other main component were MAX7219 chips. Now, if I was to source the chips from the UK they would have been in the order of £9 each. eBay had them for a tenth of that price. These were pretty certainly cheap knock offs, but for that price I could order way more than needed and suffer a few DOA chips.

Of course, it wasn’t that straight forward. I didn’t realise just how close the LEDs were packed on the PCBs which meant I needed flangeless LEDs. Needless to say when I received the LEDs from eBay they had a flange on the dome which meant they would not fit. Hunting around in the forums, I found a possible source of LEDs from China that were definitely flangeless. So, re-order and wait.

Whilst I was waiting for the parts to turn up I hit a bit of luck. Probably the hardest main part to make myself was the dome. There are lots of different options for these, from aluminium to styrene or fibreglass. The runs for these are fairly infrequent, especially if you want a certain type of dome. I’d initially ruled out building my droid in aluminium due to cost and the fact I’ve never worked with metal before, but someone on the UK builders Facebook group mentioned they had a dome and a set of body skins available in aluminium. It was too good an opportunity to miss, so I bit the bullet and bought them. A couple of days later they turned up!

IMG_0136_CR2_embedded

This was scary, this was starting to be a large commitment. It is fun tho, so lets carry on!