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.
To build a project, follow the official nRF Connect SDK guide
- 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.
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.
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.
- You might notice that the IMUs
MPU6050
andMPU9250
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.
Notice how it doesn't work at all. The tuning and HW needs some work.