Initial commit

This commit is contained in:
Lauri Võsandi 2022-03-15 22:44:03 +02:00 committed by Lauri Võsandi
commit dc7b625ab0
3 changed files with 75 additions and 0 deletions

.gitignore vendored Normal file
View File

@ -0,0 +1 @@

45 Normal file
View File

@ -0,0 +1,45 @@
# Introduction
This is vanilla firmware option for the
[sumorobot platform](
we use at K-SPACE.
The goal of this firmware option is to NOT get WiFi, Bluetooth or remote
programming in the picture and simply let the user program sumorobot
using favourite text editor or IDE and to upload the firmware via USB cable.
# Preparation
On Ubuntu make sure your user can access serial port.
If necessary run following, log out and and log into your desktop session again:
gpasswd -a $USER dialout
The firmware is flashed via USB cable. No need to press buttons on the robot.
The servo motors might interfere in some corner cases so USB connectivity is
not particularly reliable, just try to run `` again.
# Bulk deployment
To build self-contained firmware image for ESP32 use, eg when you need to flash
multiple robots easily:
docker run --rm -v $PWD/modules:/src/ports/esp32/modules -v $PWD/build:/build
To flash the built binary:
``` -p /dev/ttyUSB0 --chip esp32 -b 460800 write_flash -z 0x1000 firmware.bin
To open up serial console:
picocom -b115200 /dev/ttyUSB0

modules/ Normal file
View File

@ -0,0 +1,29 @@
from utime import sleep_ms
from machine import Pin, PWM
class ServoMotor():
def __init__(self, pin):
self.pwm = PWM(Pin(pin), freq=50, duty=0)
self.prev = 0
def set(self, speed):
if self.prev == speed:
# Prevent jerkiness
self.prev = speed
if speed == 0:
self.pwm.duty(int(33 + speed * 66 / 100))
print(self.pwm, 33 + speed * 66 / 100)
left_motor = ServoMotor(13)
right_motor = ServoMotor(15)
while True: