Minecraft Bluetooth Ore

Recovered – Minecraft Cube

A few years ago I made a bluetooth minecraft cube for a friends birthday. It got featured on hackaday.com of which I was and still am an avid reader. This for me was a great achievement πŸ™‚ Anyway somewhere along the line I actually managed to loose all of the information on the build! I was devastated. Long story short I think the traffic I got from HAD managed to get it archived by the Internet Archive Wayback Machine. So Im putting here for reference rather than anything else. Having read it, it’s not that good, missed some key info and source code but was fun to do and I wanted to have it here to remember.

I posted it on the forum on DangerousPrototypes.com and got featured on their blog too.

Original Article - Minecraft Bluetooth Ore

After my flowers went down a treat on Valentines Day I decided that I needed another project. A friends birthday is in April, so I figured that would be enough time to build something. While reading my usual news stuff I came across this http://imgur.com/a/Z2Uvu and thought it looked cool. But I wanted to go one better, using RGB LEDs to change the color of the cube! Then I decided to attempt one better and make it android controllable. Below is the first part of my journey :) its broken into 2 sections as both the electronics and cube assembly were done in tandem. Everything can be found in this post :)

Cube

Different Ore Blocks

 

 

 

I started with looking at the different blocks that were all the same (or at least similar) design. On the left are the 7 standard Minecraft Ore blocks. Chances are that the Coal Ore block is a no no.

 

The next thing was deciding how big I wanted my cube. 100x100x100mm was the chosen size. Just picked it out of thin air.

For the outside of the cube I had a few options:

  1. Paint the cube with 5 shades of grey. (You see what I did there?) – These small model paint pots are about Β£2 each and I would need about 4. I ruled this out alot because of the time! Would take ages.
  2. Use some form of stickers to cover the outside. – I decided to go down this route.
  3. Or instead have different cross hatch patterns for different shades. – Not really an option as not really familiar with options.

minecraft block face

Having decided upon the sticker option I needed a PDF to send off to be printed. Due to the size of the cube it needed to be A3 in size. Initially I had a small image of the side of the cube shown on the right. 128Γ—128 but I needed it to be converted to 100mm. I did this using GIMP but without using any filter. It simply makes it bigger, it didnt quite fit to 100mm so I think it ended up being 101.6mm. I then laid them out in a shape that would make a cube (without the base). This is shown below.

 

Cube Layout

Once I had this image, I cheated and pasted it into M$ Word at 100% and then used a free PDF printer to generate a PDF for the printing. To print it I turned to ebay (there really is nothing you cant find on here). I used this guy who printed my design onto A3 stickers for Β£2.50 each (+ Β£2 per order P+P). His packing left something to be desired and they came rolled up in bubble wrap but he wasnt that expensive and I ordered 4 to play with.

To let light out of the cube I decided on frosted perspex, Ive never really used it much before but seemed like the ideal solution to diffuse the LED light. Again I turned to my trusty ebay to order a sample. I ordered a 120x120mm square from this guy for a steep cost of Β£1.90 with free P+P.

Once both had arrived, I cut out a single side of the sticker and stuck it to the sheet of perspex to see what the results were.

perspex_cutoutsticker perspexsticker_othercube_300

 

Once I had this, I chopped up an amazon box to give me a back and side then put some red LEDs behind it and below is what it looked like. Not bad to start with. The LEDs were not diffused so you can see them shining (if you know what I mean). Click image for bigger one.

cube_perspex_red_led

 

——————————————————————–

I decided that I wanted to use perspex windows. Being the lazy person that I am I didnt want to have to hack/coping saw out 50 pieces for the cube. So I started researching. Sadly we have nothing that can cut as small as I would like at work. After contacting an old university friend I decided that I really wanted to play with lasers!!!! :D

A quick google pointed me to a place called Access Space, Sheffield which has what they call Refab Lab. I wandered down to meet James and John who work there. Really really helpful people and its nice to find people that are enthusiastic about generally making cool stuff!!!

So I set off making a cube to laser cut, and actually managed it. But once it was laser cut all the sides were the wrong way round and it was a little too small. It turned out like below.

lasercutecube

If you read part 1 you might remember for some idiotic reason the stickers were 101.25mm per side. And instead of making my own cube, I cheated the second time and used a cube maker. This site saved me about 4 hours on the last cube!!!!

boxmaker

http://boxmaker.rahulbotics.com/ Basically gives you a PDF of a template to what you want!!! :D

boxmaker_pdf

This however was no good for me, I needed to be able to load it into my CAD software CATIA. So more googling and I came across another jem! http://www.pdftodxf.com/ which does exactaly what is says on the tin!

The I imported to my CAD package and added the holes to my cube. I had originally set out to use foam board for the cube, but after finding out how much fun using a laser is and how cheap 3mm mdf is my choice was easy. Anyway I overlayed images on my cube and ended up with the following.

catia_cube

I moved the background images to the hidden layer, exported to dxf for the laser cutter and set off to AccessSpace Sheffield for round 2 :)

This time I took some photos of the process.

2013-03-12 18.05.10 2013-03-12 17.19.18 2013-03-12 17.23.09 2013-03-12 17.27.29 2013-03-12 17.28.23 2013-03-12 17.31.37

2013-03-13 17.18.11

 

My next step was the perspex windows, I needed a template to laser cut them from frosted perspex. I took some printed measurements from my stickers and then sized them up into my CAD package. I then created a dxf from the layout so I could get them laser cut. My final laser cut file look like this.

lasercut_perspex

 

My aim was to try and fit as much as possible on an A4 sheet of perspex. This was actually my second attempt, my first looked like this.

lasercut_perspex_old

But after meeting with James and John at Access Space, I was pointed in the right direction.

It all laser cut the second time (I know I dont seem to get anything right first time!). The first time the laser actually moved the plastic mid run and ruined the first A4 sheet. As shown in the images below. The second was alot better. (John at Access Space helped me alot with this!)

wrong_laser_2 wrong_laser_1

So I ended up with the following pile of bits.

2013-03-08 14.41.38

——————————————————————–

Now I have everything to make my cube. The wooden cube, the windows and the sticker for the outside. So I started building:

2013-03-13 17.35.15

The first thing was to cut out the windows on my stickers. Then an hour later I finally finished cutting it out.

2013-03-13 17.56.56

Then I folded the sticker around the cube, but first I scored the folds using a steel ruler to make it a little easier.

2013-03-13 18.01.30

2013-03-13 18.10.48

Then I placed in the perspex windows. I dont think they need gluing as they are a very snug fit, and the sticker seems to keep them in place.

Finally I have something that looks pretty good if I do say so myself. The only issue I have with it is that the sticker has white tabs and a white line down each edge. It would have looked alot better I had made these the same colour as the cube.

2013-03-13 18.15.14

 

 

Electronics

Now I have the cube I needed to think about the electronics. Ok ,well it didn’t actually happen in that order :p I did them both at the same time.

Anyway I wanted to use the PIC16F818 or 819 as I had recently done some work with them and decided that I liked a how simple it was to work with them. Yes its a bit overkill pin wise but all it needs is power and with the right configuration bits can use its internal oscillator. Easy peasy. I will post the code but im not really going to go into too much detail.

After posting my idea in the dangerous prototypes forum someone pointed me in the direction of http://dangerousprototypes.com/2013/02/15/rgb-led-driver-board/ designed by Sjaak. It seemed a good place to start. So I stripped out everything I didnt need and rewrote it a little to work how I wanted. I wanted to be able to call a function such as set_colour(red, green, blue).

I used 3 pins on the PIC connected to transistors to switch the RGB on and off.

I then got the colours for the different minecraft blocks. Had to change them slightly due to the brightness of the blue overpowering the other colours.

For testing I just wrote a loop routing to cycle through the colours, eventually when my bluetooth modules arrive I will design an android app to control the cube. But so far this is what I have with my breadboarded circuit and built cube.

2013-03-13 18.46.54

 

2013-03-13 18.46.57

 

My bluetooth modules finally arrived. They were from DealExtreme (along with some other loot) and were cheap and alot smaller than I was expecting. I took a photo next to a standard USB plug. :)

2013-03-15 14.29.51

2013-03-15 14.31.44 2013-03-15 14.32.20

They work by connecting to the PIC using 2 standard pins, RX and TX. One massive balls on my part was that the PIC I used doesnt actually have any UART onboard. Oh well some digging around and I found some bit banging code I’ve used before. Really simple no frills bit banging.

Initially I couldnt get it to work. Very frustrating as I didnt have a usb to serial. I was pretty sure it was the fact the baud rate was too high. Anyway I ordered one off ebay for about 6 quid and once it arrived I connected it to the FTDI USB to serial. I then changed the baud to as low as possible (1200) and then the name etc. I found this website very helpful for commands. However I didnt need to tie the STATE pin high to send AT commands. Secondly I used putty to send the commands on windows. But when I typed β€œAT+BAUD1β€³ I kept seeing the response β€œATOK+BAUD1β€³. This was because putty sends on a character basis, so to send the entire command I had to copy it then paste it into the putty window.

The software was modified to take commands over the serial connection. I hit a problem with the microcontroller being distracted by the LED PWM. The only way I could think to solve this was once the RX pin receives the start bit then disable all interrupts and let the bit banging (serial comms) have all the resources, this worked a treat.

The video below shows me entering the characters β€˜R’, β€˜G’ and β€˜B’ into a command on BlueTerm for Android changing the colour of the cube. I also tested it with screen on mac which I may at some point write a short post on here.

Amusingly the video is crap quality because I would normally record it with my phone, but I was using that so I had to settle for my laptop camera.

The next step was to proto board this mofo out. Took me bloody ages, each led has 4 resistors.
The final result looked as follows. I then needed to power it, this was an easy one. USB :) I salvaged a connector from some random boards I got from John at AccessSpace, connected it to a switch and plugged it in. (Not really sure if I should have done some voltage regulation or not??) I did have to use a simple potential divider as the bluetooth module only took 3.3V on the input signals.

2013-03-22 14.24.25 2013-03-22 14.24.25

I did have a little transistor problem (mainly a gap in knowledge than a problem) but as always the people at dangerous prototypes helped me out. I assembled the cube and I was almost done. :)

Once I had everything pretty much sorted I wrote my Android app to control it. Now I had no prior Android experience but I have done alot of Java programming in the past. Basically what happened was I hacked together a few other peoples stuff till I had something like what I wanted. I wanted a splash screen. Its for a friend and we call him princess so it has a splash screen with the princess from mario kart :) then it is a simple swipe gallery (using viewpage) and a button. The button reads the image number and sends a command based on the number. The address of the bluetooth is hard coded. The source is at the bottom with all the files, it is really hacked together and isnt really great coding. Big thanks to the following people/sites:

Here is a photo and a couple of videos of the final thing. The sticker is a little battered and I will prob use another one over the top. Just not got round to it :)

OLYMPUS DIGITAL CAMERA

2013-03-26 20.30.39

For some reason the videos are really dark and the colours on the Android app are slightly off.

Stuff I used:

If something is missing, you want more info or have any questions fire a comment.