5WITCH OSC

by LightClub in Circuits > Remote Control

1360 Views, 13 Favorites, 0 Comments

5WITCH OSC

P1090727 TOSHOP OSC.jpg
RVBJ.gif

I'm Gaffer in the french TV/cinema Industry, and I've wondered for a long time How to perform a light effect, everytime, with perfect timing, when an actor have to turn off/on light from a switch in real time.

A solution is based on the Open Sound Control (OSC) format, and consists of commanding most professional light controllers, brands like MaLighting, Chamsys, ETC, Obsidian, LightShark, or IOS app too like Luminair. 

It's more versatile than send a specific DMX parameter for only one device. OSC format can control a Cues List for exemple and this cues list could be modified depending on your lights effects.

Supplies

P1090720.JPG
P1090716.JPG
  • XIAO ESP32S3 board (9€)
  • LIPO battery like L601730 (5€)
  • any wall switch you want


We gonna create a connected, wireless, and autonomous switch with a XIAO ESP32S3 board, and a 3.7v Lipo Battery. The circuit diagram is very simple and requires only four solders. The ESP digitals outputs have their own internal resistance to pull-up the signal, so no need for resistors in our circuit, it'll be configured with the code.

Aside from the power of this board, that we don't need that much, benefits of the ESP32S3 compared with older EPS boards are multiples in this project. 

Cheap, Tiny, but mainly with the USB C port, the charge/discharge battery management and program upload are easier. 

The project could be done with the famous ESP 8266-01s board with antenna embedded, but in this case, you have to add a battery management board.

OSC Commands Available

First, look for OSC commands available with the light controller you use in the manual from the constructor. In addition, Keep a look about the OSC Network Settings. Ip address, Income Port, Outcome Port have to be configured properly.

For exemple with the LightShark LS-1, the controller I use, an OSC command could be a simple sentence like "/LS/Go/PB/ *PlaybackNumber* ". I have to be sure to send this message into the good network, to the correct IP address, into the appropriate port, to obtain the same result as a GO Playback, (or LAST CUE, or BLACKOUT, ...) that i can trigger from the controller.

The Code

To upload the code into the ESP, you have to run Arduino IDE framework for the following step.

(available here): https://www.arduino.cc/en/software

If it's your first use, I suggest you to see some tutorials to configure it. No difficulties, but it could be necessary to upgrade libraries and microcontroller boards. Arduino IDE need to recognize the XIAO board (or another esp board if it's your choice) For that I suggest to you to see the process on the seeedstudio wiki: https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/

Download this sketch. It is the program to upload into the ESP mini-controller after edit few modifications according your network and the famous OSC command line who gonna drive your light controller. 


You have to edit the code:

  • Line 10

the name of your wifi network 

the password 

#ifndef STASSID
#define STASSID "NameOfTheWifiNetwork"
#define STAPSK "Password"
#endif


  • Line 25

the digital pin where you'll connect the switch.

// ******** LED PIN CONFIGURATION ******************

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = LED_BUILTIN; // the number of the LED pin


  • Line 35

The ArgumentOSC and the OSC command line

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int buttonVal = 0;
boolean buttonChanged = false;
int argumentOSC = 8;
String adresseOSC = "/LS/Go/PB/";
String phraseOSC;
const char* messageOSC;


  • Line 45

the IP address and communication ports into the WIFI UDP Part. 

WiFiUDP Udp;                           // A UDP instance to let us send and receive packets over UDP
const IPAddress destIp(**,**,**,**); // remote IP of the target device
const unsigned int destPort = 8***; // remote port of the target device where the ESP sends OSC to
const unsigned int localPort = 9***; // local port to listen for UDP packets at the ESP (another device must send OSC messages to this port)


Be sure to connect IDE Arduino with the good board and the good USB port before uploading the sketch. 

*explanation about OTA (Over-The-Air)*

The OTA part into the program allows to update the ESP through the wifi, no need anymore usb c cable after the first upload. Very useful for a wireless and autonomous use, if you have to modify the code at the last minute.

Arduino IDE is supposed at this moment to recognized the Xiao Board on a new wifi port and could upload code over the air.

Test the Code and the Network

2.jpg
1.png
3.png

OK, so after the first upload, the faster way to test the board is to plug it to usb-c port to run the program.

If you have already configured you Light Controller and prepared some states or lights effects corresponding to the OSC action just wrote into the program, you can test the network.

Then take a wire and link the GND pin and the Digital Input Pin you have choose. You're supposed to get your light effect now.

Pay Attention! In some case, it depends the ESP board you use, it could exist difference between Digital Input Pin number and GPIO nomenclature.

Indeed. Please take a look to the Xiao Diagram for exemple. D1,2,3, ... means Digital Input. But the code is refering to the GPIO 1, 2, 3, (means General Purpose / Input Output). For exemple with this board, GPIO 6 is D5, but D6 is GPIO 43


If that doesn't work, some tips to debug by yourself:

  • an IP scan software could be helpfull to be sure your network is properly configured. Light controller, router, and all the ESP you use should be "seen" by the IP scan.
  • If it's good, you can use Wireshark to "read" the hexadecimal format message over the wifi you are trying to send from ESP to controller. It indicates you the ip adress of the sender and receiver.
  • Finally, the problem could come from the format of the OSC message. Indeed, arguments can be of different types, like Integer, Float, boolean, null, (it depends the expected command like fader, BlackOut, cue call, ) ... With a soft like Packet Sender, or with the Hexler's PROTOKOL app you can test in easier way the OSC message.

Soldering and Integration Into the Switch

Battery Soldered.jpeg
P1090715.JPG
P1090714.JPG
P1090712.JPG

When you are soldering a Lipo Battery directly to the board, you must take many precautions to avoid the risk of a short circuit. Please pay attention to polarity. I can suggest to solder the wires with connectors first and then connect the battery.

About wires from the switch, you have to solder one of them corresponding to the board pin written into the code, and the other wire on the GND pin.

Final step is to try to integrate esp board and battery with the small room left into the wall switch.


Let's Play

5WITCH OSC (From ESP32 to Astera Titan Tube)

Wireless and autonomous, your new 5WITCH OSC becomes a real fake switch that can be manipulated by actors while they play, synchronously, and without disturbing their concentration.

GO FURTHER: Smaller Means Made to Measure

P1090710.JPG
P1090709.JPG
P1090703.JPG

I designed a customized 3D printed switch even smaller that looks like the props lamps switch. 

5WITCH OSC by Benoit Jolivet is licensed under CC BY-NC-SA 4.0.

USB Slot stay available for battery charge

The case could be open in translation and allows to hang up the switch to a cable. Of course, this combinaison is totally fake. It becomes a props who can be manipulated by comedians. Very simple, fast, no connection. 

Supplies

P1090708.JPG
reeed-switch.jpg
P1090707.JPG
P1090705.JPG

you need:

  • XIAO ESP 32S3 Board of course, the design is made to measure for this card.
  • Lipo battery L382527 like
  • a Reed Switch (ILS for french) with a AT around 10 to 20 (Size 5mm Long, 1.8 mm Diameter)
  • a Magnet (size 5x2.5x2 millimeters)
  • a tin can to make the spring effect to the switch

Inside the switch, the connection between the top and the bottom parts is made without any contact. Thanks to the combinaison of a reedswitch and a magnet. A reed switch is composed by two tiny metal blades whose contact themself when the magnet gonna approched enough closer to them.

This is the moment to solder the reed switch between GND Pin and D7/GPIO44 pin. This position is important notably to obtain the best interaction with the magnet.

The most important at the step of soldering the reed switch on the board, is the orientation of the blades. It must be in the same alignement of the magnet magnetism field. Better the position will be, faster the contact will be. 

3D printed parts requires a little bit of precision. I suggest you to print all layers at 0.1 mm or thiner if your printer can.

Assembly

Once all the parts 3D are printed, you have to glu Digital part and BTN part together. The reason is just to obtain a cleaner and a better look.

Then, you clip the BTN into the cover. After that you gonna cut small metal sheet from a can. You can combine two or three together depending on the thickness of the metal sheet. That provides the spring effect to the bouton to obtain a good switch effect. This step is important to quantify the force of the spring, its resistance and its speed when it switches.

Last things is to glue the magnet into the BTN part. There is an appropriate snick for this.

Once both sides of the switch are ready, that means esp, antenna and lipo battery are in position for the bottom side, and button, magnet and spring effect are assembled together for the cover side, the moment arrives to slide and joined the two parts together. But before, keep in mind to keep away the side of the button with the magnet before slide. This is to prevent any shock of the magnet with the reed bulb. 

Do You Know OGIV3 and D4LLE

F32SOE0KWKOOZH1.jpg
FARF13OLCUJ8S9N.jpg

OGIV3 and D4LLE are both accessories for Helios Tubes.

The first, to be combined with a China Ball: Take a look

The second to be used into suspended ceillings: It's over there