
SpiderBot with bluetooth and android app
This is one of my least favourite projects. It's been marred by so many of problems that i've lost count.
It began as a robot controlled through wifi with a webinterface that worked most of the time. The difficulty of connecting it to a new network made the user friendliness nonexistent and i tried to switch over to communication through two nRF24l01 modules.
I never got the nRF24l01s to work properly and I dont really know why. It could have been bad connections with the servos jump wires, some incompatibility with the stm32 microcontrollers, bad soldering or bad code. The problem could have been the controller or the robot itself. The nRF24l01 modules, for example, didn't work at all until i removed the pinheaders and replaced them with wires.
In an effort to reduce instances where something could go wrong I switched to bluetooth. A HC-05 bluetooth module to be precise. I cut off the jump wires and soldered them to a protoboard that connected all parts.
The arduino sketch is pretty straightforward. It has a simple "SpiderServo" class that handles the attach and initial movement. Ideally the movement functions should be moved from the main file to SpiderServo. The main loop waits for bluetooth data and runs the appropriate function.
For the android app i followed a couple of online guides on bluetooth and made a couple of changes to suite my needs. I kept it simple and skipped pairing new devices so the HC-05 need to be paired with the phone like any other BT device. After selecting your SpiderBot in the list of paired bluetooth devices the app connects and control buttons are enabled.
The data sent to the SpiderBot is in the buttons TAG. This was the easiest way i could think of to use the same OnTouchListener without a long Switch-statement. An OnTouchListener that detects when the button is pressed and released enables the user to hold a button for continuous movement.
About servos
The servos used in this project are the SG90, an cheap servo that should be avoided if at all possible. If I for some reason ever want to use small servos in a project it will be the MG90s servo with metal gears. Unfortunately I only had two MG90s servos and were unaware of the problems of the SG90s so i ordered a 12-pack of them. Only eight of them are still working and one of them have a 3d printed gear.