wiki/content/post/2020/kiefer_pine.md

56 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2020-04-12 10:39:24 +02:00
+++
date = "2020-04-11T00:00:00+02:00"
2020-05-23 20:36:04 +02:00
title = "Self-contained and smoke"
2020-04-12 10:39:24 +02:00
highlight = true
draft = false
2020-05-23 20:36:04 +02:00
tags = ["kieferbot"]
2020-04-12 10:39:24 +02:00
+++
A day of highs and lows. Here's Kieferbot still in [teleop][teleop]
mode but now self contained:
<video controls src="self.m4v"></video>
The [PinePhone][pinephone] is taking commands from a PS4 DualShock
over Bluetooth using `ds4drv` and sending them to the IO board over
serial. I experimented with a few transports:
- UDP over Wifi was fine, but the default ESP32 Wifi power mode added
random latency of up to 100 ms. Switching to 'always on' mode by
modifying MicroPython fixed this.
- Bluetooth Low Energy worked for one-way communication to the IO
board, but there was lots of packet loss when using Bluetooth for
both the joystick and IO.
Inspired by [Firmata][firmata], I settled on MIDI over serial. I
quite like the MIDI format for short messages. A frame starts with
the command followed by a command specific payload. The command has
the MSB set so it's simple to frame.
I also compiled [ROS Kinetic][kinetic] for Debian Buster and created an IO node
that takes left and right velocity commands. There seems to be an
ordering issue with either the ESP32 PWM chip or the FIT0441
controller, where going from forward to reverse and vice-versa is
fine but the motor won't start sometimes when going from zero.
So plenty of highs, but the low was [releasing the smoke][smoke] - I'm
using a LiPo battery for the supply and something short-circuited when
unplugging the battery. It seems to have taken out the regulator and
the ESP32 flash.
Next step is to re-make the IO board using an [ItsyBitsy M4][m4]. It
also runs MicroPython so the IO software was easy to port. I've
ordered some Seeed [XIAO][xiao] boards - $5 gives you a MicroPython
compatible SAMD21 with 9 pins of IO which is enough for this project.
This time I'll secure the battery socket better and 3D print a
shield.
[pinephone]: https://wiki.pine64.org/index.php/PinePhone
[teleop]: https://en.wikipedia.org/wiki/Teleoperation
[firmata]: https://github.com/firmata/protocol
[xiao]: https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html
[kinetic]: http://wiki.ros.org/kinetic
[smoke]: https://en.wikipedia.org/wiki/Magic_smoke
[m4]: https://www.adafruit.com/product/3800