nio is built to unleash the power of distributed computing. We love building creative solutions with lightweight nodes, such as Raspberry Pi. In this case study, we connected a Raspberry Pi, DC motor hat, and sensor to create a mini autonomous car.
Similar to full-sized autonomous cars, the control intelligence for our car has to be at the edge, that is, at the car, to avoid network latency, overhead, and interruptions. We pack all the logic for this car on a Raspberry Pi.
Everything from self-driving remote control cars to industrial automation can be built on the nio platform. Simply configure blocks within the System Designer.
This car was built over several quick iterations--adding functionality each time. Robust projects start small and scale elegantly for both individual and enterprise creations.
Custom block creation
Building blocks to add to the open source nio library is simple. In this project, we built blocks for a new sensor and car control.
Want to see for yourself? Watch this video
How to build an autonomous
car with a Raspberry Pi
Let’s dive into the details of our build that combines lightweight computing, sensors, actuators, a remote control car, and nio:
Counter interval simulator
To begin the service, a Counter Interval Simulator block sets the polling rate of the sensor. This blocks allows for simple control of the appropriate sample rate for the hardware and the use case.
Autonomous cars contextualize their surroundings with combinations of technology--radar, sonar, LIDAR, GPS, and/or cameras. Our car uses a RGB sensor to read the color gradient of a track. Augmenting this solution with additional technology and sensors is as easy as adding a few blocks to the service.
A PID (Proportional Integral Derivative) block enables us to quickly implement a control algorithm with tunable control parameters. The RGB sensor detects the color of the track beneath the car to adjust the turn value, as necessary.
With the Modifier block, any stream of signals can be reshaped on the fly. We are using it here to adjust the speed and maximum turn value of the car.
The PiCar block processes a signal stream that includes the speed and turning value. It translates that to motor actuation of a DC motor HAT--turning the wheels at variable speeds. This service lives on the car itself to help minimize latency of the PID control.