VelociBus

VelociRotor
VelociRotor
VelociRotor9V
VelociRotor9V
VelociRotor9H
VelociRotor9H
VelociButtons
VelociButtons
VelociGesture
VelociGesture
VelociReceiver
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
Breadboard Example
Breadboard Example
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

VelociRotorSchematic DiagramVelociRotor 2022.pdf
VelociRotorDimensional DrawingVelociRotor M331 dimensional drawing.jpg
VelociRotorPIC12F1822 Source CodeVelociRotor.asm
VelociRotorExample Arduino CodeVelociRotor.ino.txt
VelociRotor9Schematic DiagramVelociRotor9.pdf
VelociRotor9Dimensional DrawingVelociRotor9 M528 dimensional drawing.jpg
VelociRotor9PIC16F1516 Source CodeVelociRotor9.asm
VelociRotor9Example Arduino CodeVelociRotor9.ino.txt
VelociButtonsSchematic DiagramVelociButtons.pdf
VelociButtonsDimensional DrawingVelociButtons M430 dimensional drawing.jpg
VelociButtonsPIC12F1822 Source CodeVelociButtons.asm
VelociButtonsExample Arduino CodeVelociButtons.ino.txt
VelociGestureSchematic DiagramVelociGesture.pdf
VelociGestureDimensional DrawingVelociGesture M430 dimensional drawing.jpg
VelociGesturePIC12F1822 Source CodeVelociGesture.asm
VelociGestureExample Arduino CodeVelociGesture.ino.txt
VelociReceiverSchematic DiagramVelociReceiver.pdf
VelociReceiverDimensional DrawingVelociReceiver M404 dimensional drawing.jpg
VelociReceiverPIC12F1822 Source CodeVelociReceiver.asm
VelociReceiverExample Arduino CodeVelociReceiver.ino.txt
Shared LibraryPIC Code LibraryLibrary.zip
InterfaceArduino LibraryFEARLESS_VelociBus.h

  VelociRotor Module  
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  
VelociRotor Module VelociRotor 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  
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  
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  
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 setup
void 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 stream
boolean 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.
Example
vbus_packet pkt; // allocate a packet workspace
if (vbus.poll( &pkt )) // receive & decode VelociBus events
  // process packet

Diagnostic test of VelociBus integrity
int8_t chainLength()
Returns number of modules in Velocibus chain
-1 if unexpected error
0 if loopback failed (broken chain).
Example
int chain_length = vbus.chainLength(); // should match number of modules

VelociRotor Module
VelociRotor9 Module
Configure rotor acceleration and button events
void 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
Example
rotorConfig( 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 functions
void 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
Example
vbus.rotorDecode( pkt, rotorSpinHandler, rotorButtonHandler ); // decode & call back on events

VelociRotor Module
VelociRotor9 Module
Decode packet for rotary spin value
int8_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
Example
uint8_t spin = vbus.rotorDecodeSpin( pkt );

VelociRotor Module
Set LED color
void rotorLED( int8_t address, uint8_t color )
address = module address
color = 5 bit color: bggrr
Example
vbus.rotorLED( TX(VROTOR_ADDR), vbus.ROTOR_COLOR_RED );

VelociRotor9 Module
Set 7-segment LED brightness and orientation
void 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
Example
vbus.rotor9setBrightness( TX(VROTOR9_ADDR), 3 ); // set max brightness (3), normal orientation

VelociRotor9 Module
Show digit on 7-segment LED display
void rotor9LED( int8_t address, uint8_t value )
address = module address
value = 0-15 for 0-9, A-F
Example
vbus.rotor9LED( TX(VROTOR9_ADDR), 3 ); // show '3' on the LED

VelociRotor9 Module
Show special character on 7-segment LED display
void rotor9LEDspecial( int8_t address, uint8_t code )
address = module address
code = 0-7 for - _ H J L P o u
Example
vbus.rotor9LEDspecial( TX(VROTOR9_ADDR), 0 ); // show a dash on the LED

VelociButtons Module
Configure the button events and neopixel brightness setting
void 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
Example
vbus.buttonConfig( TX(VBUTTONS_ADDR), 3, false, true ); // set max brightness (3), disable release events, enable long press events

VelociButtons Module
Set pin to output
void 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)
Example
vbus.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 color
void 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
Example
vbus.rotor9LEDspecial( TX(VROTOR9_ADDR), 0 ); // show a dash on the LED

VelociGesture Module
Set Gesture Mode
void 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
Example
vbus.gestureMode( TX(VGESTURE_ADDR), 3, false ); // maximum sensitivity

VelociGesture Module
Set Color Recognition Mode
void 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
Example
vbus.gestureColor( TX(VGESTURE_ADDR), 3, false ); // maximum sensitivity, RGB only

VelociGesture Module
Set Proximity Mode
void 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
Example
vbus.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).
Example
int button_pressed = pkt.data;
Button index layout:

This remote doesn't happen to implement all of the buttons, but they're there.