![]() VelociRotor |
![]() VelociRotor9V |
![]() VelociRotor9H |
![]() VelociButtons |
![]() VelociGesture |
![]() VelociReceiver |
VelociBus is a family of sensor input modules that operate on a serial bus.
VelociBus modules:
Breadboard Example - 3 rotary encoders, IR receiver, Gesture sensor, 2 debounced buttons, 5 LEDs, and an 8 Neopixel bar.
Example code
An Arduino Pro Mini module is used here, plus a Serial-I2C Bridge.
The bridge provides a second serial port so the Pro Mini serial port is free for programming and debugging use.
Each VelociBus module is addressed by it's position in the serial chain. Module addresses ranges from 0 to 62 (63 devices maximum). Address 63 is a broadcast address. The module address depends on the physical location in the serial chain and whether the packet is command or data. The module addresses are reversed for outgoing (command) and incoming (data) packets.
Design Documents
VelociRotor | Schematic Diagram | VelociRotor 2022.pdf |
VelociRotor | Dimensional Drawing | VelociRotor M331 dimensional drawing.jpg |
VelociRotor | PIC12F1822 Source Code | VelociRotor.asm |
VelociRotor | Example Arduino Code | VelociRotor.ino.txt |
VelociRotor9 | Schematic Diagram | VelociRotor9.pdf |
VelociRotor9 | Dimensional Drawing | VelociRotor9 M528 dimensional drawing.jpg |
VelociRotor9 | PIC16F1516 Source Code | VelociRotor9.asm |
VelociRotor9 | Example Arduino Code | VelociRotor9.ino.txt |
VelociButtons | Schematic Diagram | VelociButtons.pdf |
VelociButtons | Dimensional Drawing | VelociButtons M430 dimensional drawing.jpg |
VelociButtons | PIC12F1822 Source Code | VelociButtons.asm |
VelociButtons | Example Arduino Code | VelociButtons.ino.txt |
VelociGesture | Schematic Diagram | VelociGesture.pdf |
VelociGesture | Dimensional Drawing | VelociGesture M430 dimensional drawing.jpg |
VelociGesture | PIC12F1822 Source Code | VelociGesture.asm |
VelociGesture | Example Arduino Code | VelociGesture.ino.txt |
VelociReceiver | Schematic Diagram | VelociReceiver.pdf |
VelociReceiver | Dimensional Drawing | VelociReceiver M404 dimensional drawing.jpg |
VelociReceiver | PIC12F1822 Source Code | VelociReceiver.asm |
VelociReceiver | Example Arduino Code | VelociReceiver.ino.txt |
Shared Library | PIC Code Library | Library.zip |
Interface | Arduino Library | FEARLESS_VelociBus.h |
VelociRotor Module
The VelociRotor concept is that the faster the dial is spun the greater the result.
So the idea is to spin the dial fast to get near the desired value quickly,
then slow down the dial turn to precisely set the value.
The amount of acceleration has four settings from zero (one step per detent)
to high acceleration.
A VelociRotor module consists of a rotary encoder and a 31 color LED:
VelociRotor9 Module
The VelociRotor9 module replaces the color LED with a single digit 7-segment LED display.
The display can show numbers 0-9, letters A-F, and a few other characters like dash.
The decimal point on this tiny 7 segment LED doesn't actually do anything.
There are two board layouts and the LED can be inverted on command so the module can be mounted with the LED
on the top, bottom, left, or right of the knob.
A VelociRotor module consists of a rotary encoder and a single digit 7-segment LED display:
VelociButtons Module
The VelociButtons module provides up to 16 debounced buttons, of which 8 can be turned into open drain outputs.
Plus a string of up to 8 neopixel bulbs.
VelociGesture Module
The VelociGesture module uses a ADPS9960 sensor module (the purple board plugged into the VelociGesture board).
Usually incorporating more than one ADPS9960 sensor is difficult because it has a fixed I2C address. However with VelociBus using several of these sensors is no problem.
The VelociGesture module has three operating modes:
VelociReceiver Module
The VelociReceiver module decodes NEC IR protocol, which is commonly used by those little 21 button remote controls.
Application Interface
The interface library include file is FEARLESS_VelociBus.h.
Required setupvoid begin( Stream *serialport ) |
Example#include "FEARLESS_VelociBus.h" // VelociBus interface library VelociBus vbus; // create a VelociBus interface vbus.begin( &Serial ); // connect VelociBus to Serial port |
Handle VelociBus incoming data streamboolean poll(vbus_packet *pkt) |
Poll fast to avoid serial buffer overrun.
Returns true if packet is being returned. Packet contents is specific to the module type. |
Examplevbus_packet pkt; // allocate a packet workspace if (vbus.poll( &pkt )) // receive & decode VelociBus events // process packet
|
Diagnostic test of VelociBus integrityint8_t chainLength() |
Returns number of modules in Velocibus chain
-1 if unexpected error 0 if loopback failed (broken chain). |
Exampleint chain_length = vbus.chainLength(); // should match number of modules |
VelociRotor Module |
VelociRotor9 Module |
Configure rotor acceleration and button eventsvoid rotorConfig( int8_t address, ROTOR_ACCELERATION accel, uint8_t button_events )
|
address = module address
accel = rotor acceleration, 0=minimum, 3=maximum button_events = bitwise OR of button press event enables: BTN_DI_PRESS disables button short press events BTN_DI_HOLD disables button long press events BTN_EN_RELEASE enables button release events |
ExamplerotorConfig( TX(VROTOR_ADDR), VelociBus::maximum, vbus.BTN_DI_PRESS + vbus.BTN_DI_HOLD + vbus.BTN_EN_RELEASE ); |
VelociRotor Module |
VelociRotor9 Module |
Decode packet and call back spin and button press handler functionsvoid rotorDecode( vbus_packet pkt, void (*spinHandler)(int8_t address,int8_t spin), void (*buttonHandler)(int8_t address,BUTTON_EVENT event) )
|
pkt = VelociBus packet
spinHandler = callback function to handle rotor spin buttonHandler = callback function to handle button events |
Examplevbus.rotorDecode( pkt, rotorSpinHandler, rotorButtonHandler ); // decode & call back on events |
VelociRotor Module |
VelociRotor9 Module |
Decode packet for rotary spin valueint8_t rotorDecodeSpin( vbus_packet pkt )
|
pkt = VelociBus packet
Returns spin value (-31 to -1 or 1 to 31), 0 if packet is a button event |
Exampleuint8_t spin = vbus.rotorDecodeSpin( pkt ); |
VelociRotor Module |
Set LED colorvoid rotorLED( int8_t address, uint8_t color )
|
address = module address
color = 5 bit color: bggrr |
Examplevbus.rotorLED( TX(VROTOR_ADDR), vbus.ROTOR_COLOR_RED ); |
VelociRotor9 Module |
Set 7-segment LED brightness and orientationvoid rotor9setBrightness( int8_t address, int8_t value, boolean invert_LED = false )
|
address = module address
value 0=off, 1=low, 2=medium, 3=high brightness invert_LED sets upside down orientation |
Examplevbus.rotor9setBrightness( TX(VROTOR9_ADDR), 3 ); // set max brightness (3), normal orientation |
VelociRotor9 Module |
Show digit on 7-segment LED displayvoid rotor9LED( int8_t address, uint8_t value )
|
address = module address
value = 0-15 for 0-9, A-F |
Examplevbus.rotor9LED( TX(VROTOR9_ADDR), 3 ); // show '3' on the LED |
VelociRotor9 Module |
Show special character on 7-segment LED displayvoid rotor9LEDspecial( int8_t address, uint8_t code )
|
address = module address
code = 0-7 for - _ H J L P o u |
Examplevbus.rotor9LEDspecial( TX(VROTOR9_ADDR), 0 ); // show a dash on the LED |
VelociButtons Module |
Configure the button events and neopixel brightness settingvoid buttonConfig( int8_t address, uint8_t brightness, boolean enableRelease, boolean enableLongPress )
|
address = module address
brightness = 0..3 for minimum..maximum brightness enableRelease = enable release events enableLongPress = enable long press events |
Examplevbus.buttonConfig( TX(VBUTTONS_ADDR), 3, false, true ); // set max brightness (3), disable release events, enable long press events |
VelociButtons Module |
Set pin to outputvoid buttonOutput( int8_t address, uint8_t bit, boolean state )
|
address = module address
bit = 0-7 for pins 0..7 (pins 8..15 are always inputs) state = false(0) or true(1) |
Examplevbus.buttonOutput( TX(VBUTTONS_ADDR), 7, 0 ); // set button pin #7 as output LOW |
Once a pin has been made output it cannot be made input until power is cycled. |
VelociButtons Module |
Set neopixel colorvoid buttonPixel( int8_t address, uint8_t pixel_index, uint8_t color_index )
|
address = module address
pixel_index = 0-7 color_index = 0 off, 1=red, 2=green, 3=blue pixel is set at current brightness |
Examplevbus.rotor9LEDspecial( TX(VROTOR9_ADDR), 0 ); // show a dash on the LED |
VelociGesture Module |
Set Gesture Modevoid gestureMode( int8_t address, uint8_t sensitivity, boolean enable_indeterminate )
|
address = module address
sensitivity = 0 off, 1 min, 2 med, 3 max enable_indeterminate = enable reporting of indeterminate gestures |
Examplevbus.gestureMode( TX(VGESTURE_ADDR), 3, false ); // maximum sensitivity |
VelociGesture Module |
Set Color Recognition Modevoid gestureColor( int8_t address, uint8_t sensitivity, boolean enable_white )
|
address = module address
sensitivity = 0 off, 1 min, 2 med, 3 max enable_white = enable white detection events |
Examplevbus.gestureColor( TX(VGESTURE_ADDR), 3, false ); // maximum sensitivity, RGB only |
VelociGesture Module |
Set Proximity Modevoid gestureProximity( int8_t address, uint8_t sensitivity, boolean enable_exit_events, boolean enable_nearfar_events )
|
address = module address
sensitivity = 0 off, 1 min, 2 med, 3 max enable_exit_events = enable proximity exit event enable_nearfar_events = enable both near and far proximity events |
Examplevbus.gestureProximity( TX(VGESTURE_ADDR), true, true ); // maximum sensitivity |
VelociReceiver Module |
There are no interface functions for the VelociReceiver module.
There are no configuration settings. The packet data is the remote control button index (0 to 20). |
Exampleint button_pressed = pkt.data; |
Button index layout:
![]() This remote doesn't happen to implement all of the buttons, but they're there. |