Blog - Note for POLYUCS Edison Traffic Light 

Page / - last modified by Victor Zhang on 00:27, 22/07/2020 

Note for POLYUCS Edison Traffic Light 
last modified by Victor Zhang
on 00:27, 22/07/2020

Table of Contents

•	Download package: Source Code for arduino (Currently hard coded)
•	Makes use of FreeWiFi via POLYU (with a workaround)
•	Makes use of mqtt.eclipse.org
•	Announce topic: POLYUCS/esp8266/shared/pub (will have start msg and ping msg)
•	Config topic: POLYUCS/esp8266/devices/ESP8266Client-bcddc22df583/pub
•	If switch device should then be : POLYUCS/esp8266/devices/<device-id>/pub
•	Worked on top of Clifford Choy's implementation
•	Commands and example:
•	Set sequence timer, in ms, d[green, greenblink, yellow, red]: 
{
  "c": "setTime",
  "d": [5000,5000,5000,5000]
}
•	Set blink on off time, in ms, d[ontime, offtime]:
{
  "c": "setBlink",
  "d": [500,200]
}
•	Set brightness, d:0..255
{
  "c": "setBrt",
  "d": 128
}
•	Reboot, d:<a number hardcoded>
{
  "c": "reboot",
  "d": 1234
}
•	To change Defaults (Starting from Line405):
int brt = 255;
const unsigned long max_seq_time[] = {120000, 60000, 60000, 120000}; // for now not allowing more than 2 minutes
unsigned long seq_time[] = {20000, 5000, 4000, 25000};  // default green, blink, yellow, red
unsigned long blink_time[] = {400, 200};
•	MQTTBox settings:

Posted by Victor Zhang  · Permalink