- Ultrasonic Sensor programming
- mainboard pcb schematic
- other modules
- documentation
This is a modifiable AI robot project using a Jetson Nano at its core. It is designed to be easy to build (it just snaps together with no glue required) and easy to modify. This can be done with modules, which connect to a shared bus system and can be accessed very easily. Everything except the base is considered a module. The tires in the images also are a module. The robot features easy camera control and an AI-stack, which makes it easy to use many neural nets on the bot.
- Jetson Nano as a core for stable control and AI capabilities.
- ESP-32 coprocessor to handle the module bus and other parts of the bot.
- Wifi antenna
- Infrared camera
- Big battery
- Ultrasonic distance sensor
- RGB lighting
- Everything else that can be done with modules
Modules play a special role in this project. Everything aside the main body is considered a module. Two modules can be attached to the top and one to the bottom, as well as one directly to the main board. I have remapped a USB connection for easier attachment.
Available modules include (unchecked boxes are to-do):
- Drive Module (attached in pictures)
- Dev Module (create custom modules)
- LiDAR module
- BME680
- LoRA module
The modules I make in this project are located in modules.py
. An example script for controlling the wheels of an attached drive module:
from nullbot import modules
# the script will panic if the module is not physically attached
bot = modules.DriveModule()
# drive forward for one second
bot.forward(1)
The camera in this project is a normal IR camera compatible with raspberry pi. You can register a callback function which takes a PIL image as parameter, which will then be executed as a LoopThread (watchdog). The camera can also be a target in the AI Stack.
The Jetson Nano contains CUDA-cores, whch can be used for accelerated neural networks. To run many models easy and with the same resources, the nullbot contains an AI Stack. Models / Wrapper Models that inhertit StackNetwork
from ai.py can be put onto the AI stack. There are two types of stack, an image stack and a misc stack. The Image stack can use models that take a PIL Image as parameter, other models can be put onto another stack. With run_stack(*args)
you can run a stack, for example as callback frunction for the camera, which returns an Image. The stack determins by itself, if it should use the image or misc stack. If activated, the bot will run the ai_stack
function. The stack can be for example used with an avoidance network. An example code for the AI stack:
from nullbot import ai, camera
from PIL import Image
class MyModel(ai.StackNetwork):
# This is an image stack network
image = True
def __init__(self) -> None:
# your neural net here
pass
def ai_stack(self, img:Image) -> None:
# do some inference here
pass
model = MyModel()
ai.add_to_stack(model)
camera.camera_with_callback(ai.run_stack)
When the bot is running, it is important, that crashing tasks dont interrupt the whole bot. For that purpose the bot has LoopThreads. Example code:
from nullbot import watchdog
from time import sleep
def test():
print("ping")
sleep(1)
thread = watchdog.LoopThread(target=test, daemon=True, name="Example Thread")
thread.start()
The case is 3d printed (stl files in hardware/stl
)
Needed materials:
- Jetson Nano
- Infrared Camera
- Alfa Wifi Adapter
- ESP32
- NullBot Junction PCBs
- WS2812 LEDs
- Ultrasonic sensor
- Battery Pack
- other small stuff
To set up nullbot Jetson Nano:
- Flash the JetPack image
- Install neede python packages onto the jetson nano
- You have to build OpenCV with Gstreamer support from source
- copy the nullbot package to python site-packages directory
To set up nullbot ESP32 coprocessor:
- Install ESP-IDF
- go to the coprocessor source
get_idf
idf.py menuconfig
- go to Component config -> i2c master config
- set sda and scl pin
- go to Serial flasher config and set flash size
- exit and save
idf.py -p /dev/ttyUSB0 flash
The drive module uses two H-bridges and a Pi Pico microcontroller as main chip. The default i²c address is 0x56
.
The dev module uses an ESP32 as processor and can be used to prototype custom modules very easy. Up until now libraries are only available for ESP-IDF and Pico SDK, an Arduino Library in on the way.
Assembled Bot with Drive Module
Drive Module
RGB lighting
Prototyping and programming (white prototype)