Skip to content

Commit

Permalink
feat!: Complete rewrite. Add serial interface, move driver to ext lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
madskjeldgaard committed Jul 19, 2024
1 parent 7baeebb commit d546421
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 227 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This firmware will turn a Raspberry Pi Pico with two [DRV8833 motor controller b

It maps midi notes to one of the 4 currently available channels and uses the velocity of the notes to set the speeds.

It also features a small auto sleep function which will activate the DRV8833's sleep mode when idle.
It also features a small auto sleep function which will activate the [DRV8833](https://www.ti.com/lit/ds/symlink/drv8833.pdf)'s sleep mode when idle.

## Midi mapping

Expand Down Expand Up @@ -36,6 +36,24 @@ In all note on messages, the velocity is mapped to the speed of the motor.
| note on 63 | motor 2 b | forward |
| note off 63 | motor 2 b | stop |

## Serial Interface

The serial interface allows you to control the motors via serial commands. The general format of a command is `set <motor> <property> <value>`. Here's a breakdown of the command structure:

| Command Part | Description | Valid Values |
| ------------ | ----------- | ------------ |
| `<motor>` | Specifies which motor to control. | `1a`, `1b`, `2a`, `2b` |
| `<property>` | Specifies which property of the motor to set. | `speed`, `dir`, `stop`, `sleep`, `decay` |
| `<value>` | Specifies the value to set the property to. | Depends on the property. For `speed`, it's a float between 0 and 1. For `dir`, it's either `forward` or `reverse`. For `stop` and `sleep`, it's not used. For `decay`, it's either `fast` or `slow`. |

Here are some examples of valid commands:

- `set 1a speed 0.5`: Sets the speed of motor A on motor driver 1 to 0.5.
- `set 2b dir forward`: Sets the direction of motor B on motor driver 2 to forward.
- `set 1a stop`: Stops motor A on motor driver 1.
- `set 2b sleep`: Puts motor B on motor driver 2 to sleep.
- `set 1a decay fast`: Sets the decay mode of motor A on motor driver 1 to fast.

## Dependencies

You need to have platformio installed to make use of this.
Expand Down
206 changes: 0 additions & 206 deletions include/DRV8833.h

This file was deleted.

15 changes: 13 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@ check_tool = clangtidy
check_flags =
clangtidy: --checks=-*,cert-*,clang-analyzer-* --fix
lib_deps =
# USB support
; USB support
Adafruit TinyUSB Library
# MIDI
; MIDI
https://github.com/FortySevenEffects/arduino_midi_library

; Send commands to this board over serial
ppedro74/SerialCommands

; Schedule tasks, timers, etc.
arkhipenko/TaskScheduler

; DRV8833
../libraries/DRV8833Arduino



[env:raspberrypi-pico]
; See https://arduino-pico.readthedocs.io/en/latest/platformio.html
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
Expand Down
Loading

0 comments on commit d546421

Please # to comment.