Embla-Flatlandsmo / nRF9160dk-balancing-robot

port of balancing robot project to the nRF9160 DK using nRF Connect SDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nRF9160 DK Balancing Robot

balancing-robot-three-quarter-view

This is a project that aims to port a balancing robot project written for the nRF52832 DK using the nRF5 SDK v13, to the nRF9160 DK using the nRF Connect SDK.

The problem is that the hardware used in this project requires a REALLY tight tuning (if the balancing robot goes +-10 degrees from equilibrium, it cannot get back to the equilibrium) so the current robot does not balance. Stronger motors and/or larger wheels is needed to make it easier to balance this robot.

Building

To build a project, follow the official nRF Connect SDK guide

Project setup (Using existing nRF Connect SDK installation)

  • Clone this project into a folder that has an nRF Connect SDK installation v2.1.2. I used ncs v2.1.2.
  • Build and flash the project as you would with any sample. Make sure that the physical switch SW10 on the DK is set to the chip you want to flash to.

nRF9160

The nRF9160 implements the IMU and Encoder sampling and ties it all together in a control loop.

The project uses zscilib to get the device's orientation based on gyro and accelerometer values.

nRF52840

This chip is currently not in use, but some gpio pin routing settings might cause LEDs on the DK to light up when the motor board is connected. If this is a problem, feel free to build+flash the basic program in nRF52840 which disables the pin routings.

Notes

  • You might notice that the IMUs MPU6050 and MPU9250 are used a bit interchangably. These are pretty similar. A driver for MPU9250 was recently implemented (see PR#40702). Before that, MPU9250-support was "hidden" in the MPU6050 driver (as seen in PR#32623)
  • The IMU is not always found upon initialization. If the balancing does not start after 3 seconds, press the reset button on the DK.
  • The robot uses a custom PCB whose schematics have been included in the schematics folder.

Useful links

Demo video

Notice how it doesn't work at all. The tuning and HW needs some work.

balancing-robot-demo.mp4

About

port of balancing robot project to the nRF9160 DK using nRF Connect SDK.


Languages

Language:C 95.8%Language:CMake 4.2%