Electrical Design

Electrical Design


Electrical and Software Integration.

To allow our BB8 to run wirelessly over Wi-Fi, we used a Raspberry Pi 0w, a MOD ESP8266 Wi-Fi chip, and an Arduino Uno. Initially, our goal was just to be able to send commands to the BB8 through the command line, and have them executed on the BB8, essentially like a remote control device. But after we got this working, we wanted to allow the BB8 to make decisions itself based on camera input.

First we had to flash firmware onto the MOD ESP8266, which can be compared to an Arduino Feather Huzzah. After flashing the Wi-Fi chip, we wrote a script that would allow the Wi-Fi chip to access a server and return a message from that server to verify that our chip was working.

We took similar initial steps with the RasPi, downloading initial software, and writing a script that would allow it to connect to Wi-Fi. Once we verified that both the Wi-Fi chip and the RasPi 0w worked individually, we set up communications between the two using MQTT. With the two modules running MQTT we were able to send a message from the RasPi command line, and have the Wi-Fi chip print out the results.

The final step in getting our initial communication goals met, was transferring messages from the Wi-Fi chip, to the Arduino Uno. To do this we used I2C communications, so we essentially wired the Wi-Fi chip to the Arduino, and allowed them to communicate over serial. We integrated the MQTT and I2C code that needed to run on the Wi-Fi chip into one script so that both could be running simultaneously on the chip. This got us to our initial goal of being able to send commands from the computer to the RasPi to the Wi-Fi chip and finally, to the Arduino. At this point, we were able to control the BB8’s movements by entering letters on the computer. To get the camera integrated, we wrote initial code that would recognize faces, and then convert face locations into motor speeds. After confirming this program worked on the RasPi, we connected the RasPi with the communication protocol described above so that the camera would send the calculated motor speeds to the device.

The diagram below shows the 3 systems combined.

Electrical diagram