Our objective today is to control the virtual glider with one of our prototype kits. So we assembled the cirtcuits required to connect the MPU6050 sensor, the real time clock and the LCD display.
While the code showed no problem, Condor wasn’t seeing the MPU6050 sensor. After troubleshooting for a while including using a logic level analyser, we created a new sketch to scan the I2C bus. This gave us some unexpected results. It seemed that some of the devices connected to the I2C bus weren’t connected. We checked and re-checked our connections but they were fine. So we proceeded by elimination, removing 1 device at a time from the bus. This made us realise that 2 of our devices use the same 0x68 I2C address: the RTC clock and the MPU6050 sensor.
Fortunately, the MPU6050 datasheet gave us a convenient work around. The sensor will define its address as either 0x68 or 0x69 depending on the logic level of the AD0 pin. We connected the AD0 pin to our 3V3 supply and re-ran our I2C scanner. Thankfully, all devices now appeared. We were back on track!
Our next hurdle was the MPU6050 library. The library offers no way to define the sensor’s I2C address when the object is created. There is, however, a constant defined in the library’s header file with the address of the sensor. Modifying the value of the constant and recompiling fixed our problem.
We also resolved a couple of issues with writing messages on the LCD display.
Once we had reflashed our firmware on the Ardunio Leonardo, we spent time working out what our firmware needed to send Condor in order for Condor to recognise it as a valid input. This took quite a bit of fiddling but led us eventually to fly our virtual glider using the prototyping kit and the firmware. This was a major breakthrough and a perfect end of 2019: not only was it satisfying to see our code working but, more importantly, it proved our design beyond doubt.
We can now focus on soldering the boards, finalising our firmware, assembling everything inside the glider and creating support frames.
What started as a dream in February 2019 is now becoming reality.