Lego, Nordic and Android App BLE = mini rover
Here is the fruit of my weekend work: a small three-wheeled rover that I can drive with an App on my Android phone with BLE.
Note that the rover has “on board” an old smartphone (from 2011!) which serves currently only as a counterweight, but in the future it will be used for "other things"... the most curious people can return to the site to find out what these new features will be. Calm and don’t push!
To move the rover I used two small modified SG90 servos. For details on modifying the servos, I refer you to this article on my website: “Pedrone” Part # 1 - Trimming stop point on modified servo .
Now I will write three words that will make Lego Technic "purists" shiver: screws, glue and double-sided tape. Yes, to put together the rover (with the pieces of the "Pedrone") I used these dirty tricks, but only where it was strictly necessary! I don't know if there are any pieces "made on purpose", but anyway, since Lego is now a memory of when my children were small, I took the liberty to do as I pleased ... Here are the incriminated photos:
To power the device, I used an old circuit built to power back up a Raspberry Pi board. Here it is:
If you are interested in this 5V output backup unit, please read my old article: Single 3.7V Li-ion cell battery back-up for Raspberry Pi .
Let's see the wiring diagram of the circuit:
I used the USB “dongle” with the Nordic SoC nRF52840 described here . On the diagram we see a connector for a USB-Serial interface (at 3.3V) which is only needed if you want to read the messages sent by the firmware (format 115200, N, 8,1) in the various operating phases. This connector is for debugging only and will not work if you are using a Nordic module like the one described here, because the pins used for the serial are not available (except by writing a modified firmware version, which this time I do not do, as this project is only a preparation for something more complex). The firmware should still "run" on both modules, as long as the wiring is modified properly! Note that on my power supply I have set the output for 5.5Volt, since the step-up allows me to do that. This voltage goes directly to the motors and instead passes through a diode to get to the modulus, so there is a small voltage drop, which is irrelevant in this case.
The firmware to be programmed on the module, following the instructions provided in my other post https://hackaday.io/project/185996-ble-module-and-android-app-voil-the-lamp is included in the.zip file available in "files" section. Again, I used the Zephyr RTOS development environment to build the program.
Now we come to the Android App, which I wrote using Anywhere Software's B4A . This is also included in the .zip file that is provided here. The App is not published on the "market" and therefore to install it you must give consent to manage Apps from "unknown sources". Let's see what happens when you do it:
From the Android 6 version onwards, a warning appears for the user informing him of the "permissions" requested by the App. To use Bluetooth BLE, geolocation must also be enabled. On the left in the image there is this request. You must also remember to turn on both Bluetooth and the location service and then, by launching the App, you will see the screen on the right. By clicking on Connect, we will go to the next step, the scan of the reachable BT devices:
On the left we see the list of devices, which can also be long, depending on the number of devices available. We look for what is called ROVERone_xxxx and press long on the element of the list. Finally we will make contact with the circuit and the screen on the right will appear. Now, by pressing on the various arrows, the rover will move as desired. In the top box, the command sent from the smartphone to the circuit will appear (in the figure below, on the right, I have put the App icon):
In this case, we read...
Read more »