Bullroarers
Overview
This page documents technical details of the control system for the Ann Hamilton's bullroarer piece at the Henry Art Gallery. Prepared October 2014.
Hardware
- Arduino nano
- relay module
- ethernet module
- ultrasonic rangefinder
Networking Scheme
The 21 bullroarer nodes are hooked up in a simple closed network with a single host computer. Each node has a unique IP address, as does the host. I am using the UIPEthernet library for networking.
- Node Addresses: 192.168.3.1 - 192.168.3.21
- Host Address: 192.168.3.100
OSC Messaging
The bullroarer nodes use Open Sound Control to communicate with the host computer. You can find an introduction to Open Sound Control here, and details of the OSC Specification.
Messages from each node are tagged with the ID of that node. They start with a base address pattern of /br/ followed by the node's number, 1-21. For the examples below I am using messages from node 1, so they start with the base address of /br/1/.
Control messages from the host computer are sent directly to each node at their IP addresses. Thus, they do not contain any node-specific information in their addressing pattern.
The bullroarer firmware uses the OSCuino library for Arduino and Embedded Processors to do OSC messaging.
Sending
Each node can send 4 messages to the host computer. These messages are tagged with the number of the node they are coming from in their address pattern. Examples below come from node 1 (/br/1):
- /br/1/range, integer (0-1024)
- Current analog sensor reading from ultrasonic rangefinder between 0-1024. 0 would be a minimum in close to the sensor, 1024 would be a max distance away from the sensor.
- Sent every 200 ms (so 5 Hz refresh rate).
- /br/1/limit, integer (0 or 1)
- State of limit switch.
- Sent when button is pressed or released. Switches are active low, so the value is 0 (LOW) when the button is pressed, 1 (HIGH) when the button is released.
- /br/1/relay, integer (0 or 1)
- State of motor control relay.
- Sent when relay state changes. Relays are active low, so a value of 0 (LOW) means the relay is on, 1 (HIGH) means the relay is off.
- /br/1/config, integer, integer, integer.
- Sent when requested.
- First value is auto mode, (0 for "off", 1 for "on").
- Second value is max range (0 - 1024). This is a threshold value for the lower limit of bullroarer travel. When in auto mode, a sensor reading larger than this value will trigger the relay to turn the motor back on and raise the bullroarer.
- Third value is cycle timeout, (0 - max long int). Sets the amount of time the bullroarer waits at bottom before starting motor, the "rest time". Only works when in auto mode.
Receiving
Each node can receive 6 messages. These messages are sent directly to the node IP address via UDP (i.e. for node 1, they are sent to 192.168.3.1), and do not contain any node-specific information in their osc address tags. There is 1 control message and 5 configuration messages.
Control Message:
- /relay, integer (0 or 1)
- Turns relay on or off.
- Relays are active low, so a value of 0 (LOW) means the relay is on, 1 (HIGH) means the relay is off.
Configuration messages. The following five messages change run-time behavior of a node in automatic mode, and read or write those configuration values:
- /auto, integer (0 or 1)
- Sets automatic mode. 0 for "off", 1 for "on".
- /max, integer (0 - 1024)
- Sets the threshold value for the lower limit of bullroarer travel. When in auto mode, a sensor reading larger than this value will trigger the relay to turn the motor back on and raise the bullroarer.
- /timeout, long integer, 0- max long int.
- Sets the amount of time the bullroarer waits at bottom before starting motor, the "rest time". Only works when in auto mode.
- /write, integer (0 or 1)
- Writes the current runtime configuration (auto, max, and timeout) to the bullroarer's EEPROM. This will save the current settings for next startup. Otherwise they are lost.
- /config, integer (0 or 1)
- Sends the current runtime configuration for the bullroarer to the host computer.