Houdini MC allows you to send are receive instructions to and from micro-controllers using GET or POST requests (hereafter we will refer to these requests as web request)
Preliminaries: Assume a Raspberry Pi, and Arduino based mechanism of a smart prop or even your mobile phone. These devices can interact with Houdini MC mainly using web requests. When the Raspberry Pi or the Arduino receives a web request from Houdini MC, it performs a predefined action. Similarly, when Houdini MC receives web requests from a connected on the same local network device, it also performs a custom action.
In other words, this communication procedure requires two parties. A sender and a receiver. Both Houdini MC and micro-controllers can serve either as senders or receivers. If Houdini MC awaits instructions from a micro-controller so as to perform an action, then it acts as a receiver. But if Houdini MC triggers a script on micro-controllers, then it serves as a sender.
More details about web requests: Each web request consists of 2 parts. The first part is the IP of the receiver and the second part is a custom TERM. These 2 parts shape a unique URL. A script on the receiver continuously awaits for web requests from a sender. If the received web request contains a desirable TERM, then the receiver performs an action.
E.g.: Assume an Arduino connected on the same local network with Houdini MC. In this scenario, the Arduino acts as a receiver while Houdini MC, as well as all the other connected on the same network devices, serve as senders. Assume also that the local IP of the Arduino is 220.127.116.11. A script on Arduino continuously listens for incoming web requests from a sender. If for example a sender pings the URL: 18.104.22.168/SAMPLE, Arduino receives the term SAMPLE and performs an action. Overall, the Arduino programmer assigns a set of actions for each expected TERM.
To start with, execute Houdini MC and go on the “Settings-> Connections” tab. Enable the “Incoming HTTP Requests” and note down the given URLs. This option allows Houdini MC to perform as a receiver.
Please make sure that your router always assigns Houdini’s PC the same IPv4 address. From this moment, Houdini MC is ready to receive incoming requests.
Close the settings menu.
You will now notice a green bulb icon on the top of the console. This icon indicates that Houdini MC is ready to accept incoming requests.
To test the ability of the software, use your tablet/mobile device and point a browser tab at the noted URL. In our case, the URL for “Clue Button” is 192.168.178.101:14999/clue while the URL for “Panic Button” is 192.168.178.101:14999/panic.
Please make sure that both, Houdini MC and your mobile device are connected to the same local network. After sending the request, you will notice that the color of the bulb icon changes, based on the type of the request.
Outgoing and incoming connections can be affected by the presence of firewalls or antivirus software on the PC connection. Windows comes with a built-in Internet Firewall that is active by default and blocks suspicious traffic. You can turn off this firewall (not recommended by Microsoft) or configure it to allow connections from and to specific ports.
To open a port in the Windows firewall:
- On the Start menu, click Run, type WF.msc and then click OK.
- In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane.
- In the Rule Type dialog box, select Port, and then click Next.
- In the Protocol and Ports dialog box, select ANY. Select Specific local ports, and then type the port number of the instance, such as 1433 for the default instance. Click Next.
- In the Action dialog box, select Allow the connection and then click Next.
- In the Profile dialog box, select any profiles that describe the computer connection environment when you want to connect and click Next.
- In the Name dialog box, type a name and description for this rule, and then click Finish.
1.How to receive instructions from a controller
- Go on <Scheduled Events> and select “Add Event”
- Select “Incoming Event from Smart Mechanism”
- Use a “Custom_Term” and write down the entire URL (e.g. http://192.168.178.104:14999/Custom_Term)
- Select action (e.g. play a sound, trigger another device, play video, control HUE scenes, etc.)
- Press “Save Event”
- Now, every time a connected on the same network device pings this URL when the game is active, the event will be executed! So simple! Again, to test your smart event, ping the URL directly from your mobile phone (since your phone is connected on the same network)
To see how you send an instruction through a Raspberry Pi please follow this tutorial
2.How to send instructions to a controller
You can also use Automation Menu to send GET and POST requests to a microcontroller.
- Go on <Automations->HTTP Requests> menu
- Create a new GET or POST request
- Name the request (in the depicted case is “End_The_Siren”)
- Press Execute to send the request
- The Response text box will display the response from the device (if any)
- By pressing the “Save Changes” button, the selected web request can be stored for later USE. Stored requests are available under the “Saved Requests” section.
Stored requests are accessible not only from the <Automations> menu but also from the <Shortcuts> tab.
Finally, it is worth noting that stored requests can also be executed as part of scheduled events. Simply, go on <Scheduled events> select a new timed on a smart event and assign the stored web request. If timed events are used, Houdini MC will send the stored web request on a specific timestamp. In case of smart events, Houdini MC will send the stored web request when e.g. players solve a riddle.
To interact with High -Voltage Devices kindly refer to this tutorial