3x3x3 LED Cube With Bluetooth (Android)

2,342

16

5

Published

Introduction: 3x3x3 LED Cube With Bluetooth (Android)

This is a guide to make your own 3x3x3 Bluetooth controlled LED cube

It all started about 2 years ago when i was in 7th Grade when I joined an electronics workshop where I was introduced to basic electronics like what is resistor, capacitor, diode, how to solder and other stuff and I started my first few electronics projects like a light sensitive switch, clap switch, etc. Then after some time I heard about Arduino. I was told that this is an amazing platform from which I could take my projects to a whole new level. I then started exploring about Arduino through internet I didn’t join any class, my only source of learning about Arduino was through googling and when I was familiar with it I brought my first Arduino. This changed how I used to look at electronics and made my first few Arduino projects.

I liked the concept of LED cubes and wanted to make one. To begin I made a 2x2x2 LED cube then I thought that it was boring that the cube isn’t in your control it runs the same program again and again. So I decided to make a 3x3x3 LED cube with Bluetooth.

I thought of writing an instructable about it but that’s when I saw chr’s instructable and I was inspired by the amount of detail he gave in his instructable so this is also a detailed instructable about a smartphone app controlled 3x3x3 LED cube.

So in this instructable I will teach you how to build this amazing project.

Step 1: Intentions

This is a very crucial step as you should always know the intention of making this project and never give up or leave the project half way. People take up projects as they like to make things, want to explore Arduino and electronics or have it as an assignment in school or office. So think about it and then move on.

Step 2: Skills

For this project there are few things you should know such

as-

· Basic electronics

· Soldering

· Programming (In Arduino IDE)

Step 3: Components and Tools

These are the things you will require for this project-

Components-

Tools-

  • PC
  • Soldering iron
  • Wire cutter
  • Drill machine
  • Hot Glue
  • Sand paper

Step 4: Get the Components

You may buy Arduino UNO from Spark-fun or Digi-Key or from

original Arduino site.

Spark fun R3

Spark fun R3 SMD

Digi-Key

And you will get genuine boards but the disadvantage is their cost. I recommend getting Arduino clones instead, they function properly as the main microcontroller (ATmega328p) for both the original and clone is the same. You can buy LEDs, resistors, and other parts from local electronics store for cheap or online.

Step 5: What Is a LED Cube?

A LED cube is a three dimensional arrangement of LEDs. Think of it as many LED matrixes stacked one above the other forming a cuboidal structure. It enables you to see in three dimensions and get some depth perception.

Every LED is individually controlled, so you can show amazing patterns on the cube.

You can get creative and make your own patterns.

Step 6: How a LED Cube Works?

LED Cubes are much more complex than LED matrixes. In a 5x5 LED matrix there are 25 LEDs in total whereas in a 5x5x5 LED cube there are 125 LEDs which are to be individually controlled, hence it gets even more complex with bigger cubes and if you want it to be RGB then it gets worse that is 3x 5x5x5 = 375 LEDs! No microcontroller has this many IO pins.

So we use the technic of multiplexing. You know that a LED should be provided positive voltage at one pin and negative voltage at the other. So we divide the cube into layers and columns (see in the picture) and connect all cathodes of a layer and anodes of a column.

Then we turn on one layer and by turning on the columns to make the required LEDs glow in that layer and then move to the next layer and so on.

This happens so fast that our eyes don’t see the layers turning on and off. So we see an image on the cube. You can see this video from Great Scott to learn more about multiplexing.

https://www.youtube.com/watch?v=uQMUPhyoXoE

Step 7: Why 3x3x3?

You might be thinking why I am making a 3x3x3 LED and why not any other size, the main reason for this is that 3x3x3 is the largest possible size of cube you can make if you want to add Bluetooth to it without making the project more complex by using Shift Registers (https://www.allaboutcircuits.com/textbook/digital/chpt-12/introduction-to-shift-registers/) as Arduino UNO/Nano/pro mini/ has 14 digital + 6 analog = 20 IO pins and a 3x3x3 LED cube requires 9 columns + 3 layers = 12 IO pins and we need two more for the HC 05 Bluetooth module (Tx and Rx) totaling to 14 IO pins.

The 3x3x3 LED cube also has some advantages compared to other sizes –

· For this cube you need not worry about power consumption or dissipation.

· Low Power supply demand.

· We don’t need any switching electronics like transistors for this cube.

· We need lesser logic terminals so we don’t need shift registers or anything like that.

· More pins are available for additional components.

Step 8: LEDs!

LEDs are basically diodes which emit light when its forward voltage is applied and that’s why they are called LEDs (Light Emitting Diodes :), so when we apply positive voltage at its anode (+) and negative voltage at its cathode (-) it lights up.

LEDs come in a variety of shapes, sizes and colours. For this project you can choose any colour of your choice or make different layers with different colours (I haven’t tried it yet but you can :D)

A 5mm or 3mm (diameter) LED would work fine as a bigger one will make it difficult to see the whole cube and the LEDs inside.

Those square LEDs would look nice, but you will face some problems while making a jig with square holes. Instead it’s easy to just drill with a 5mm or 3mm drill bit for round LEDs.

I strongly recommend a diffused (cloudy) LED rather than a clear one as a diffused LED spreads light evenly and the clear one throws almost all light at top, but both work fine.

This project technically needs only 27 LEDs but I have got 30 of them just for mistakes :D. So I have used 30 clear 5mm green LED.

Step 9: Check All the LEDs

Now check all the LEDs with a 5v power supply and a resistor (100 ohms) to be sure that they all light up at the same brightness and there is no faulty piece as you probably wouldn’t want to replace a LED after you have made the whole cube.

It is totally worth spending some time checking the LEDs as I found some faulty ones and removed them earlier.

You can also use those 3v button cells (CR032) as a power source.

Step 10: Sand the LEDs

If you are lazy or have diffused (or cloudy) LEDs then you can ignore this sanding process. Sand all the 27 LEDs with a sandpaper (we used a 150 grit sandpaper) from top and sides to spread the light evenly. Since I didn’t had diffused LEDs, I sanded all the LEDs to give them this diffused effect so they can spread light more evenly.

You can see the difference in the brightness of the clear and diffused LEDs.

Be careful don’t sand the LED too much or it will change its shape to a conical LED.

Step 11: Decide the Size of Your Cube

This is the spacing you want between your LEDs. I made my cube in such a way that there is a gap of 1 inch between 2 LEDs (see the picture).

The gap between 2 layers is as important as the gap between 2 LEDs of the same layer. Equal gaps make the cube look like a cube rather than a cuboid, the distance between 2 LEDs of x axis and y axis should be same as this makes the cube symmetrical.

While deciding the spacing you should keep in mind the size of the LED’s pins, making the gap too wide and the pins of the LEDs won’t reach other LED’s pins and you will have to use connecting wires in between.

So I decided to make the cube with 1 inch spacing.

Step 12: Make a Jig

Soldering all the LEDs in mid-air would make the LED cube in a weird shape, so you need to make a jig where you can solder the LEDs on it to create a layer.

I had this (see in the picture) jig which was made for a 4x4x4 LED Cube laying around, so I utilized it for this project. This jig was made from a piece of plywood I had in my home.

Make a 3x3 grid with 1 inch spacing (see in the picture) and mark the points where we need to drill the holes and then make a small dent on the point so that the drill doesn’t slip and then you can drill holes on the points we just marked with a 5mm drill bit (use 3mm bit if you have 3mm LEDS).

It isn’t mandatory to drill holes on a piece of wood, you can mark holes on a cardboard and punch them use sun board instead of wood or use something else.

Step 13: Bend the Pins of the LEDs

This step will help you solder the common anodes (+) of LEDs in a column. You have to bend the anode pin (longer pin) of the LED away from the cathode pin at a right angle (see the picture).

Now again bend the pin straight in the opposite direction leaving a 1mm gap approximately making it parallel to the other pin, like a Z-bend (see in the picture).

This will shift the anode pin of the LED towards the outer edge making it easy to solder the layers together.

Now repeat this for all the 27 LEDs.

Step 14: Soldering Tips

You need to be careful while soldering as you will need to solder very close to the LEDs as if you heat a LED too much then it may get damage.

These are the basic thing you need for soldering-

·Soldering iron or even better a soldering station (I used a bevel tip)

·Soldering sponge or you could use a steel wool like me to clean your iron, it’s very cheap.

·Solder (I recommend getting a flux core solder)

·Isopropyl alcohol (or just get some sprit from a medical store, it contains isopropyl alcohol)

·Helping hands (it is a nice tool for holding electronic components as they get really hot while soldering)

Make sure your soldering iron is clean. I recommend getting a flux core solder as it makes soldering easy.

Firstly tin the tip of your soldering iron, and then apply some flux where you want to solder, then just touch the part you want to solder with the side of your iron then just put a little solder.

Now clean the area where you just soldered with isopropyl alcohol and also the tip of your soldering iron.

Step 15: Place the LEDs on the Jig and Bend the Negative Pins

Now we need to make a layer, but before that we need to place our LEDs such that we can bend their negative pins easily and then solder them.

Refer the image and place the LEDs in the same orientation as the image and then bend their cathodes to connect LEDs with each other.

The pins of the LEDs should overlap a little.

Step 16: Make the Layer

Now you need to solder the negative pin which we had bend earlier. Tin the end of the LED’s pin and then solder them as usual.

Solder each joint one buy one until you connect all the negative pins together and form a layer.

If the end of your LED is overlapping a lot then you can cut it with a wire cutter or if it is too short then you can use some sort of extending wire to make the joint.

Step 17: Test the Layer and Remove It

Check all the LEDs of the layer as one might have been damaged due to overheating otherwise you will need to desolder a LED after you have made the whole cube.

You can use a 5v power supply with a 100ohms resistor and connect ground to the common cathode of the layer and then connect the VCC of the power supply to the positive pin of a LED via the 100ohms resistor to check the LEDs (refer the image for the diagram). Then connect the VCC via the resistor to one of the anode and if that LED lights up then you are good to go and then check the next LED, and if it doesn’t then may be the LED is damaged due to overheating or the soldering joint isn’t proper.

If your layer passes this step then you can remove the layer from the jig. Slowly start removing it buy pulling out each LED a bit and when all LEDs loosen you can pull it out.

Now your first layer is complete and now you can repeat the steps above 2 more times and make 3 layers in total.

Step 18: Join the Layers

This is the critical part of your cube as you want your cube to be as symmetrical as possible.

Make sure that all your pins are straight and perpendicular and then with your soldering iron tin all the ends as tinning really helps in making a very nice solder joint. Now lay one layer on your work place on its side and then the other layer and bring it close to the other and then solder one corner first then move on to the adjacent corner and solder it. Continue and solder all the corners first.

After that you can start soldering the middle LEDs and then at last the center LED and you’re done joining two layers.

Make sure you solder them at the same orientation that is they should look like this (see the image) from top.

Check the LEDs like you checked the layer in the above step. Now solder the third layer in the same way.

Step 19: Choose a Container

You will have to search for a plastic box or you could get project box which are available in the market. You have to keep in mind the following points while selecting a container.

  • It should be bigger than the LED cube
  • It should have enough space to hide our Arduino UNO and its shield and the 9v battery and other stuff
  • It should not be too large

Step 20: Modify the Box

The container that I choose was transparent so the electronics could be easily seen, so I decided to cover it with some foam paper.

I had many choices of colours but ended up choosing red colour. I cut the paper into strips and pieces that would when attached to the box would cover it and then attached them to the box. You can decorate it in any way you like and in any colour.

You need to modify the box, so that you can fix the cube on top and then hide the electronics inside it.

Start by placing the cube on top of the box and position it as you like, then mark the points where the legs of the LEDs touch the box with a marker. Make small holes where you just marked about 1mm in diameter.

You also need to make 3 additional holes between the central column and the column to which the central column is attached to (see the image).

Step 21: Attach the Cube to the Box

You need to put the cube’s column’s leads through the holes we made earlier. Pull the cube’s leads from inside of the box and adjust the cube till it fits nicely on top of the cube. Then bend the leads from inside of the box in any direction so as to prevent the cube from separating with the box.

We will use the box as the base so make sure that the cube is aligned properly to the box.

Step 22: Make Connections for the Layers

You need to make connections for the layers that is you need to connect the common ground of the layers and bring it to the box. So we need to use some sort of extension to bring the common ground inside the box to connect it.

For this we will be using the holes we made earlier. You need very thin wire so that it isn’t noticeable to anyone as it connects the layer to the box. I had a solid core wire laying around so I removed its plastic insulating coating with a bit of force and was left with a thin bare copper wire.

You need to cut this wire into 3 pieces according to the height of the 3 layers plus 3-4 cm extra. Then tin its one end with the soldering iron and do this for all the pieces.

Insert the wires with the tinned side in front through the 3 holes we made earlier between the central column and the column to which the central column is attached to. First bring the tallest wire through the hole near the center and then bend it and wrap it around the leg of the central LED and then apply some flux and solder it and then clean it with isopropyl alcohol. And you have completed joining the top layer.

Similarly do the same for the second layer through the middle hole and the third layer through the last hole.

Step 23: Connect the Wires to the Cube

Now we need to connect wires to the cube and the Arduino shield (which we will build later).

I prefer using ribbon cable for this job and keeps things organized.

At the time of making the cube I was not sure about which code I will put in the cube so I made the wiring in such a way that I could easily change the pin configuration on the Arduino. I divided the columns into 3 parts front row, middle row and last row so I have 3 ribbon cables with 3 wires in each connecting the cube’s columns inside the box.

You don’t need to do such thing, you can simply use 1 ribbon cable with 9 wires to connect the columns and 1 more ribbon with 3 wires for the layers.

Firstly separate each wire of the ribbon cable and remove the insulation off then tin the ends of the wire. Now you have to solder it to the each of the column (see the picture).

I attached 0.1" female header connectors to the ends of the cable for later connecting it to the controlling circuit and then insulated it with hot glue but it is better to use heat shrink tubing.

Cross check that you have connected the cables in the same orientation as the image.

Now you have completed the cube’s construction and the base for it! And you can set it aside and focus on building the Arduino shield next!

Step 24: What Is Arduino?

The heart of this project is an Arduino UNO board. So it is important to know about it before you use it in this project.

Arduino is an open-source electronics development board. They are called as Arduino boards which have a main computing chip which is a microcontroller. Arduino provides a huge platform for making your projects. You can refer to the original Arduino website to know more about Arduino -

https://www.arduino.cc/

You may find many Arduino boards available in the market and ask which one is suitable for this project. Well I will be using the Arduino UNO board as mentioned earlier.

Arduino UNO is based on the ATmega328p chip, an AVR microcontroller chip. Similarly Arduino Nano and pro mini is also based on the same chip and have same properties except that these have 2 extra exclusive analog input pins which cannot be used for any other purpose. So you can use them for this project since they have the same computing power. UNO has 14 digital pins of which 6 are PWM capable and 6 analog input IO pins. You can know more about Arduino or the ATmega328p by referring its datasheet.

http://pdf1.alldatasheet.com/datasheet-pdf/view/241077/ATMEL/ATMEGA328P.html

Use of Arduino Mega or other boards with high computing power for this project would be an overkill but its upto you if you want then you can still use them.

We will use total 14 pins of Arduino that is pin D2 to D10 for columns and A0 to A2 for the layers and D11 and D12 for Bluetooth communication.

Step 25: Make a Shield for the Arduino

I wanted to use the same Arduino UNO for other projects also so I decided to make a shield for the UNO on which I will keep my Bluetooth module and other parts so that I can easily remove the UNO and use it for other projects.

Cut the perf board

Get your perf board with copper dots and cut a piece with length of 20 dots and width of 19 dots (see the image) we are going to mount our resistors and stuff here.

Modify the headers

Then cut the male headers into 4 parts with each part consisting of- 6 pins for the analog input pins, 8 pins for the power pins, 8 pins for D0 to D7 and 10 pins for D8 to end. As I am an expert in cutting header pins I broke the two 8 pin headers and made them 7 pin headers (see the picture), so I decided that I will solder the 7 pin headers in place and then solder the remaining one header near it and make it work somehow.

You will notice that there is an offset between the D7 and D8 pins of the UNO and this gap is of 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins, so it gets difficult to use perf board and header pins. Therefore we need to modify the male headers to fit them.

Place all header pins in their places and then bend the short side of the headers away from the D7 pin (see the picture). Put the perf board on the headers and adjust the headers until you can fit them in the perf board (see the picture). Refer the image, there should be gap of 1 dot on the perf board.

Solder the headers

Now you can remove the headers then apply some flux and then tin them. I used a pair of scissor to hold the headers while tinning them but it’s recommended to use helping hands.

Then place them on the UNO as before and place the perf board on top with its copper side facing downwards and fit the tinned headers and apply some flux and then solder them. It is easy when the headers are already on the UNO and it will match properly.

Clean the extra soldering material like flux with isopropyl alcohol.

Step 26: Make the Connections for Columns

Remember the connectors we used for the ribbon cables to connect our cube and Arduino.

We are going to connect those cables via the male headers on our shield for Arduino. Since I had divided the ribbon wire for columns into 3 parts, I will have to use three 3 pin male headers for columns.

I had less place in my box so I had to use those right angled male pin headers and as they were not available, I had to bend the normal pin headers to make them angled ones. You can choose whichever header you prefer.

Pre-tin the male headers then solder them on the shield by following the images (you can remove the gaps between the male headers if you are using one 9 wire ribbon cable for the columns). While doing this I also soldered 3 more header in advance for the cable for the layers.

Then join them to their following digital pins of the headers connecting the Arduino (refer the images). As you can see in the pictures I used direct solder traces for some joints and wires for the others, both do the job fine it’s on you what you want to use.

Step 27: Make the Connections for Layers

According to our schematics we need to connect our common cathodes to the pins A0, A1, A2. We also need to add some current limiting resistors in between.

I used 33 ohms resistors at first but then later realized that the LEDs were too dim so I ended up using 15 ohms resistors.

As I had soldered the 3 male headers in advance. Bend the pins of the resistors so that it can fit in the PCB with a gap of 4 holes then tin them and solder them. After that connect them to the male headers and connect to the headers joining the Arduino shield ie. pins A0, A1, A2. Refer to the images.

Step 28: What Is HC 05?

HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. It uses Bluetooth2.0. You can communicate with a smartphone via Bluetooth and hence can control your Arduino with the smartphone.

For using it with Arduino you should get the one on a breakout board. The module has 6 pins EN (enable), VCC or 5v, GND (ground), TX (transmit), RX (receive) and State pin. We will mainly use the 5v, GND, TX, RX pins of the module. It requires 3.3v power and uses 3.3v logic levels. The breakout board has a voltage regulator at the VCC pin which converts 5v of Arduino to 3.3v for the HC 05, but the other pins aren’t 5v tolerant.

So you can connect the 5v and GND of Arduino directly. You have to connect the TX of the module to the RX of the Arduino and RX of the module to the TX of the Arduino. As the other pins aren’t 5v tolerant we can connect the TX of the module to the RX of the Arduino directly as Arduino is compatible but while making the other connection we cannot directly connect TX of the Arduino to the RX of the module as the 5v signal can destroy the module.

Therefore we have to use a voltage divider in between which will reduce the voltage to 3.3v. We will connect it like this-(see the image) I used a 2.2k resistor and a 4.7k resistor.

You could get one from Amazon or e-bay.

In India

https://www.amazon.in/Bluetooth-Transceiver-Module-TTL-Outputs-HC05/dp/B00R95Y0AK/

https://www.ebay.in/itm/HC-05-Wireless-Bluetooth-RF-Transceiver-Module-Serial-RS232-TTL-for-Arduino/172770299345/

International

https://www.amazon.com/HiLetgo-Wireless-Bluetooth-Transceiver-Arduino/dp/B071YJG8DR/

https://www.ebay.com/itm/HC-05-6-Pin-Wireless-Bluetooth-RF-Transceiver-Module-Serial-RS232-For-Arduino/232412681033

Step 29: Check the HC-05

If you have doubt whether your HC-05 is working properly then you can perform this test to make sure everything is good.

For this test you need-

  • bread board
  • 5v power supply
  • HC-05 (of course)
  • jumper wires

Connect the 5v and GND of the HC-05 to the 5v and GND of power supply then short the TX and RX pins of the HC-05 (connect TX to RX).

Now download an app called S2Terminal in your smartphone from playstore and connect to the HC-05 via bluetooth. It will ask for a pin code which is mostly 0000 or 1234.

Now type any random alphabets on the app and click the send button. If you see what you typed in red letters and then the same repeated in blue letters then your module is working properly.

The module receives the signal from the app and throw it through the TX pin but we have shorted the two pins so the signal travels and reaches the RX pin and the module then transmits the signal back to the app so we see the letters repeat and can conclude that the module is fine.

Step 30: Add HC-05 to the Shield

As mentioned earlier we are going to connect the module in the same way expect that instead of using the D0 and D1 pin of the Arduino we will use the pins D10 and D11 as RX and TX respectively.

I am going to place my Bluetooth module underneath the shield as I have less space on top so my photos could confuse you so keep that in mind.

I want my Bluetooth to be detachable so that I can use it for future projects so I will use headers. My Bluetooth module has angled male headers so I should use angled female headers which I don’t have so I will bend the pins of normal female headers (see the picture).

On the shield start by soldering the header in place first then the resistors and at last solder the wires and make all the connections. Make sure you follow the schematics. You can also check all joints with the continuity function with a multi meter.

You have now successfully completed making shield for Arduino.

Step 31: Connect Controller to the LED Cube

Now that you have completed making the cube and the controller it’s time to connect both of them together. You have to connect the female headers of the cube to the male headers of the controller.

Connect them so that-

Top layer è A2

Middle layer è A1

Bottom layer è A0

Now connect the columns according to images. Cross check that you have connected them properly.

Step 32: Power

To power the Arduino I will use a 9v battery for power.

Arduino has a vin pin which has a 5v voltage regulator and it is connected to the DC jack.

Connect the battery connector to the DC jack with a switch in between (see the image). Now hot glue them together.

Step 33: Install Arduino IDE

Now you need to install the latest version of Arduino IDE. Arduino IDE is the programming software for Arduino.

https://www.arduino.cc/en/Guide/HomePage

Go to the above link and under the “Install the Arduino Desktop IDE” section click the type of your OS in your PC/Laptop. Then follow the instructions and download the IDE.

Step 34: Install Remote XY Library and App

We are going to use the RemoteXY which is a mobile graphical user interface for Arduino boards and other controllers. To know more about it visit its official site- http://remotexy.com/

In order to use the RemoteXY in our sketch (program) we first need to install the RemoteXY library.

http://remotexy.com/en/help/how-install-library/

This link will guide you for installation of the RemoteXY library.

Now we have to download the app in our smartphone. It is available on play store, you can install it from there. There are 2 versions available free one and paid one, install the free one.

Step 35: Test the LED Cube

You have the whole cube with all the software ready its time to test the cube.

I have written a code to test wiring of the cube to check if all the LEDs work and if they are wired correctly. It will begin by lighting all LEDs for 2s then lights each LED one after the other starting from left bottom front LED to right top back LED.

See the video to check whether it does the same.

If it does something weird then try flipping the connectors on the shield.

Step 36: Final Code- Add RemoteXY Source Code

To be able to control our cube using the RemoteXY app we need to add some lines of code in the beginning.

To use the app I created go to this link-

http://remotexy.com/en/editor/b467b12e438413959cc5815555e36a90/

Now click the “Get the source code” button then some code will appear copy the code and paste it in the Arduino IDE the code initializes all the things we need above the void setup.

In the void setup there is a line “RemoteXY_Init ();” this line initializes all the variables and other stuff needed for the RemoteXY app to function.

Similarly in void loop there is a line “RemoteXY_Handler ();” this line is very important.

This is what the code means-

http://remotexy.com/en/help/whatiscode/

Step 37: Final Code- Initialize the IO Pins

We first create 2 variables called columns and layers where we store the name of the IO pins in an array for columns and layers.

In the void setup we first initialize everything required for the RemoteXY app then we set up a for loop in which we call each pin of the columns variable and set it as an output pin and do the same for layers.

We then call a function called ‘TurnAllOff ();’ which turns all LEDs off to avoid turning on of unnecessary LEDs in the beginning of the program.

Step 38: Final Code- TurnAllOff

This function switches off all the LEDs.

There are 2 for loops here one calls each pin of the layers and pulls it high and then the other calls each pin of the columns and pulls it low.

Remember that we have connected common cathodes of the LEDs as layers and common anodes of the LEDs as columns.

So pin of layers are active low and pins of columns are active high. Therefore pulling them opposite switches all LEDs off.

Step 39: Final Code- TurnAllOn

This function switches on all the LEDs.

There are 2 for loops one inside the other, the outer loop calls each pin of the layers and pulls it low.

Then the inner loop calls each pin of the columns and pulls it high and this causes the LEDs to light up.

Then outer loop continues and pulls that layer high.

The loop then does this for the next layer it seems that all LEDs are kept on.

Step 40: Final Code- OneByOne

This turns on each LED one after the other starting from left bottom front LED to right top back LED. It is the one I have used in the test code.

I created a variable called delayTime which stores the amount of time in which the next LED will light up.

This is same as the TurnAllOn function the difference is that there is a delaywhich waits for the number of milliseconds that is stored in the delayTime variable and then turns pulls that column low again and repeats.

See the video to see this pattern.

Step 41: Final Code- CircleAround

In this pattern the 2 columns of LEDs will revolve around the center, the central column could be kept on or off according to the programmer (this was nicer than I expected).

We first put a Boolean argument ‘showMid’ which lights central column if it is and turns it off if it is 0.

I created a variable ‘midColumn’ where the pin of the central column is stored. I then created 2 more variables where the pins of the outer columns is stored and in the other the delay is stored.

We pull all layers low then if the showMid condition is true we pull up the middle pin.

Then turn on 2 opposite columns and spin them in clockwise direction.

See the video to understand the pattern.

Step 42: Final Code- LayerByLayerUp

Layers are turned on one after the other from bottom to top. Same as TurnAllOn but delay between turning on and off of the layers.

I created a variable called delayTime which stores the amount of time. This delay time comes in between turning on and off of the layers.

See the video to understand the pattern.

Step 43: Final Code- LayerByLayerDown

Layers are turned on one after the other from bottom to top. Same as LayerByLayerUp but in opposite direction.

I created a variable called delayTime which stores the amount of time. This delay time comes in between turning on and off of the layers.

See the video to understand the pattern.

Step 44: Final Code- LayerUpAndDown

This pattern looks like layers moving up and down.

LayerByLayerUp and LayerByLayerDown pattern are mixed. First the LayerByLayerUp function is called then the LayerUpAndDown function is called.

See the video to understand the pattern.

Step 45: Final Code-Edges

The edges of the cube are displayed in this pattern.

We first put an argument called ‘amount’ that decides how many times to repeat the pattern.

The first for loop repeats all that’s inside it for the number of times stored in ‘amount’.

We first pull one layer low then if it is the middle layer then we only turn on the corner columns otherwise all the column expect the middle most column.

The layer we turned on is turned off (ie. pulled high). And the loop continues.

See the video to understand the pattern.

Step 46: Final Code- Centre

This turns on the centre LED.

The ‘TurnAllOff’ function is called to turn all LEDs off.

The middle layer is pulled low and the central column is pulled high.

See the video to understand the pattern.

Step 47: Final Code- InAndOut

This mixes up the centre and edges pattern to create Boom-Boom effect!

The edges pattern is kept on for 1000 times roughly equaling to 200 milliseconds and then the centre pattern is displayed for 200 milliseconds.

See the video to understand the pattern.

Step 48: Final Code-Void Loop

Void Loop is the most interesting part of the program, this is what your Arduino is going to run.

At first there is the RemoteXY_Handler which looks after the things for RemoteXY.

Then there is a switch case section which checks which button on the app is selected and displays a pattern accordingly.

The void loop repeats itself infinitely.

And now you have finished making a 3x3x3 LED Cube with Bluetooth!

Step 49: Upload the Code

What’s the use if you make an

awesome Arduino project and don’t upload it, well then you can’t see it running the code so upload it.

Download the final code and upload it to your Arduino. Plug the Arduino to your PC and then in the tools section make sure you have selected the correct board type and port. Now hit the upload button and you will see the TX and RX LEDs blinking fast and you have successfully uploaded the code.

Step 50: Use the RemoteXY App

Open the app in your smartphone and click the plus icon then to the Bluetooth and select the HC-05 option. It will ask for a pin try 0000 or 1234.
Then the app will open the window which you had created. Select the pattern you want to see!

Step 51: No Bluetooth? No Problem

If you want to make you cube without the control from Bluetooth then don’t worry you have to just change some things.

  • no need to download the RemoteXY library and app
  • no need to use/buy bluetooth module
  • no need to make additional modifications on the Arduino shield

I have already made a program without Bluetooth. Ready to upload!

Download it from below!

Share

    Recommendations

    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest

    5 Discussions

    I can't seem to open any of the sketches. I keep getting errors. Is there a document posted somewhere where I can cut and paste them?

    Vey nice and detailed instructable!! Congratulations!!! ;)

    Fastsstic work by Akash!
    This is really well written with all the steps and pictures. Keep up the good work

    Awesome creativity!! Information is great too!!
    Keep making such things:)

    Great first instructable! Lots of detail and your cube came out really well :)