Bluetooth Controlled Party Robot With Arduino and Android
by timvandervooren in Circuits > Robots
346 Views, 1 Favorites, 0 Comments
Bluetooth Controlled Party Robot With Arduino and Android
Welcome fellow party lovers. During these challenging COVID-19 infested times I, like many others, have been restricted in my social life and most importantly my party life. One lonely night I was thinking of a solution to this horrible problem I was facing and finally I came up with the Party Robot. This robot has a disco ball for a brain, LEDs for a spine, lasers for eyes and a speaker for a stomach. In other words: this guy knows how to party.
If you are also experiencing lonely boring nights during these dark days (or maybe even outside of the COVID-19 crisis) and you have an interest in Arduino's and robots, this Instructable is for you! And even if the COVID restrictions are lifted, you can still bring this little buddy to any party to lighten the mood.
Supplies
IMPORTANT: This project makes use of a lasercutter, you could make all the parts by hand but it is strongly recommended to use a lasercutter.
- Multiple sheets of plywood (size depends on the lasercutter you're using)
- Arduino Uno
- WS2812 LED strip, 1m should be enough but you can use more if you'd like
- Micro servo motor
- 4x parallax servo motor (with continuous rotation)
- 4x omni wheels, diameter of 58mm
- 2x laser pointer
- Breadboard
- Disco ball kaleidoscope dome (I used this one: https://www.amazon.nl/gp/product/B07SJK54T6/ref=p...
- HC05 Bluetooth module
- Any bluetooth speaker
- Android phone
Software I used:
- Arduino IDE
- Android studio
- RemoteXY
Creating the Hull
The first step for creating the Party Robot is to get all the parts of the hull. For these parts I have made use of a lasercutter. Before I could start making the 3D designs I made a blueprint with all the dimensions of the robot. You can see the blueprint in the attached pdf file.
I have used Makercase to create SVG files for the two boxes that the robot consists of, with the use of Makercase I was sure all the parts would fit together nicely. It's important to know the thickness of the wood you're using, my design have been made with 3mm thick wood in mind. After getting the box designs from Makercase I used the online design program Tinkercad to edit these SVG files into the parts I needed. The SVG files I created have been added to this Instructable. You can also make your own designs and alterations as long as you keep the dimensions of the blueprint in mind. When all your SVG files are done, you are ready to work with the lasercutter.
Apart from a lasercutter, I also wanted to make use of a 3D printer in order to create the wheel frame. I wasn't able to work with one because of some complications, but in case you want to use a 3D printer for this project I have added the STL file needed for this. KEEP IN MIND: this is a pretty big part so it will take a lot of resin and as a whole it might be too big for your printer. In that case you can just split the design in smaller parts with any 3D design program. In case you don't want to use a 3D printer you can do the same as I did and just lasercut the most important part of the wheel frame, I have also added this as an SVG file.
Assembling the Hull
After you've gotten all the pieces from the lasercutter you can start putting everything together. With the joints you've generated with the help of Makercase it should be easy to put everything together. However if you want the pieces to stay together all the time I recommend using a hot glue gun.
First you should start with the body. make sure you line up the side panels so the two holes are closest to the front panel. For the body you should keep the top open, this is where the head of the robot is going to be. When the pieces all fit together you can apply a small line of glue on each corner.
After you've assembled the body you can start with the bottom panel of the head. This part has a hole in it where it can connect with the body. If you've used the correct designs and wood thickness this part should just slide on perfectly, but it could be that the body is somewhat thicker than the hole. In this case it's important you don't use force to put it on there. Just file some of the inner edges of the bottom head part. Once this part fits you can use some more hot glue to keep it in place.
Next up you need to assemble the head. This part is going to be separate from the body part because you want to be able to access the inside of the body later on. This one is pretty straight forward, nothing can really go wrong. Make sure the face piece has the mouth hole on the open side. After you glue every piece together you can put it on the body part. If you've also cut out the gears with the lasercutter you can glue these to the head any way you want. I used them for the eyes and ears.
The arms consist of two parts each. One is the rectangular shape and the other is the triangular shape. The rectangular piece is easy to put together, it's similar to the body except it's smaller which may be a bit more difficult for the glue gun. The triangular shape is also not difficult to assemble if you put the pieces in the right way. After both parts are assembled you can glue them together. you need to glue the big flat side of the triangular part to the small side of the rectangular part. After this your arms are complete. I recommend keeping the arms loose until you have the LED strips attached and working, this makes it easier to test. When you glue the arms to your robot body remember to put them beneath the big hole on the side so the wires of the LED strip can go through.
The last part you need to assemble is the wheel frame. My servo motors didn't have screw holes on the correct side so I couldn't screw them in place, that's why I also used glue for this. Keep in mind that you need to center all these servo motors perfectly with the wheel frame or else the movement of the robot might not be 100% accurate. When all the servo's are in place you can pull the wires through the hole in the middle, this is where the wires will go into the body of the robot. Again, I recommend keeping the wheel frame loose until you have the servo motors working and you have tested the code.
Creating the Electrical Circuit
Now that you have created the hull of the robot, it's time to start working on the inside a.k.a. the electrical circuit. This robot uses quite a few components and for that reason it can easily become a big mess of cables. For clarity I have made a schematic with the help of Fritzing.
I recommend using the online service RemoteXY in order to test the bluetooth module connection and to test the communication to and from the Android phone.
IMPORTANT: You need to connect the HC05 bluetooth module to the 3.3V pin of the Arduino and not to the 5V pin, this will cause the bluetooth module to malfunction.
Upload Code to the Arduino
Before you can upload the code to the Arduino you need to check some things. If you've connected some cables to different pins on the Arduino for whatever reason, you need to update these in the code as well. You can see these PIN numbers defined at the top of the code. Besides that you could also use a different amount of LED strips than me. In this case you need to update the constant values for this as well.
If you run into an error with the FastLED library you will most likely need to install the library. With Arduino this can be done by going to "Tools > Manage Libraries...". When the library screen opens type FastLED in the search bar. You need to search for the library made by Daniel Garcia that's simply called "FastLED".
Downloads
Upload the Code to Your Android Smartphone
I have made an Android app for controlling the Party Robot. This app makes use of Bluetooth for sending the commands to the HC05 module on the Arduino and it also uses the Spotify API in order to play music through the connected Bluetooth speaker. I have shared my code on a GitHub repository, this can be found with the following URL: https://github.com/TimvdVooren/PartyRemote. The app is written in the programming language Kotlin and it's built with the MVVM design pattern (Model View ViewModel). This means that the visuals, logic and data are all separated. You can find the visual code in the "views" folder, the logic code in the "viewmodels" folder and the data in the "models" folder.
Before you can control the robot you need to change some things in the code first. In the BluetoothHandler class in the models folder you need to change the constant value of BT_MODULE_MAC_ADDRESS to the MAC address of your HC05 module. This MAC address can be found by connecting to the HC05 module with your Android phone and click on the Bluetooth settings of the device. The MAC address should be visible at the bottom of this settings page.
If all went well you can now connect to your Bluetooth module and you can control the Party Robot's lights and motors. You won't be able to use the Spotify feature yet however. This is an optional feature but if you want to implement it you should follow the tutorial found in this link: https://developer.spotify.com/documentation/andro.... There is however a fault in this tutorial regarding the command to get the SHA1 key of your Android Studio. The correct way to do this can be found on StackOverflow with the following link: https://stackoverflow.com/questions/5488339/how-c....
Experiment a bit with the app and all the components to see if everything works as it should. Once everything works correctly you're ready to put everything together.
Put Everything Together
Now that you have tested the electrical circuit with the Android app you can put everything together. This step is fairly straight forward. The most important part is that you face the robot body in the correct way the wheels are spinning. You could also adjust this in code or the circuit later but paying attention to it now will save you time. After that you can pull the cables of the wheel frame through the bottom of the robot body and connect them with the breadboard. The same goes for the cables from the LED strips on the arms and the head. If you've added more LED strips for example on the back, I suggest making a new hole in the back or maybe route the cables to the hole of the arms. Once all of the circuit is inside you can manage the cables a bit so there is some free space, this is where you're going to drop your bluetooth speaker. Make sure it's easily accessible so you can turn it on and off easily.
Get This Party Started
Now that everything is in place you are able to use the app to control your very own Party Robot and all its features. Go ahead and bring your Party Robot to life and dance like there's no tomorrow! (I suggest doing the robot dance)