This note describes how to implement a large XMAS light sequencer (for a small neighbourhood or across differents countries) using an Arduino implementation of NearBus system. This implementation will allow you to manage up to 16 lights from the web with a precision of 100 ms that provide enough capacity to implement powerful light effects at large scale.
This video shows a implementation with three Arduino platforms (Ethernet) synchronized independently (from a remote NearHub) with a time slot of 250 ms. Because there are 4 lights in this example, two Arduinos uses one channel and the third uses two channels. The lights are switched by a modified plugable outlet (with internal micro-relay).
The NearBus System
The NearBus system has two main components, the remote device controller or "NearAgent" and the Cloud Hub Manager or "NearHub". These components communicate in a periodic way through the NearBus protocol. The main feature of NearBus system is to allow you to control the remote agent form the cloud via a set of web API interface (NearAPI). Additionally the Agent implements a NearBIOS code, a set of basic MCU functions (ADC, Digital I/O, etc.) that allows you control the agent from the web in the same way as a traditional Microcontroller Unit.
Although the NearBus system has an extensive set of features, in this App Note we only analyze the features required for the sequencer implementation. For more information about the NearBus System please refer to the project overview.
How does it work?
This implementation allows you to control up to 16 independent light systems connecting each to a different NearBus Agent. The Agents are not linked together, instead there are only linked through Internet to the NearHub. To synchronize each light system the NearBIOS implements a pseudo NTP system that allows to synchronize all the agents with a precision about 100 ms. The Web Interface should be used in shared mode (between multiple users) to simplify the interaction when the light sequence is defined (see picture)
Step 1: Implementation Steps
In the picture you can see the power switches, they have been implemented by modify a simple plugable outlet (with internal micro-relay).
Step 2: Implementation Steps
Because this specific App usually will require a group of users, we recomend to define a shared account (in www.nearbus.net), and manage it between all the users to simplify the configuration process.
2- Download the Agent code library
Download the Arduino NearBus library from the download menu (www.nearbus.net) . Because this is a beta release the only one supported platform is Arduino Ethernet.
3- Set Up the new devices in the NearBus Data Base
The "New Device" menu will allow you to activate the devices in the NearBus system. When you generate a new device the system will give you a new "device_Id". This device_Id identifies your device in a unique way (like a MAC) so you will need to set this device_Id (and the shared secret) in the Arduino code before uploading it to the board.
4- Update the Agent code in each Arduino platform
Set up the right "device_Id", "shared_secret", and Ethernet MAC address before uploading the Agent code in each Arduino board.
5- Connect the light system to the Arduino Agent
This Beta release of NearBIOS supports up to 4 channels on the Arduino agent. For this App you only need to connect the "digital pins" of Arduino. The chart below shows the assigned pin for each channel:
Channel 0 --> Dig_pin 3
Channel 1 --> Dig_pin 5
Channel 2 --> Dig_pin 6
Channel 3 --> Dig_pin 9
You should connect so many channels as light systems you want to connect over each Agent (from 1 to 4).
Note: as usual, to control a power light system you need to implement a power driver. The simplest solution is to use an electromechanical relay driven by a small transistor. In the Help section you can find a diagram of this simple circuit.
The picture shows the trivial implementation of a four channel NearBus Agent with Arduino Ethernet (there in no active components in this prototype, it only has four audio jacks directly wired (Vcc, GND, Signal ) to the Arduino board ).
Step 3: Running the System
The "device list" menu will show you the device state (UP or DOWN). Be sure that all devices are in UP state.
7- Configure the Sequencer Chart
The "Sequencer" menu allows you to configure the desired sequence. You should define the device and the channel that will control the sequenced light. The picture shows the sequencer configuration screen.
For detailed information about how to configure this step, please refer to the Help section on www.nearbus.net.
8- Start the sequencer system
Select the RUN option in the configuration screen and refresh it. The system takes a few seconds to be synchronized and fully operative.
For more information about this project please contact us at: firstname.lastname@example.org