Skip to content

BrickPico Web Interface

Timo Kokkonen edited this page Dec 21, 2023 · 4 revisions

BrickPico Web Interface

If a Raspberry Pi Pico W is installed on BrickPico PCB then there is basic Web Interface available for monitoring.

brickpico-web

Configuring WiFi

To join BrickPico into a WiFi network, configure network SSID and passphrase:

SYS:WIFI:SSID mynetwork
SYS:WIFI:PASS mypassword

Manual Network Settings

By default BrickPico will use DHCP for obtaining IP address and other network settings. So normally there is no need to manually configure network settings.

To manually configure static network settings, configure IP, Netmask, and Gateway.

For example:

SYS:WIFI:IP 192.168.1.42
SYS:WIFI:NETMASK 255.255.255.0
SYS:WIFI:GATEWAY 192.168.1.1

Test Network Settings

After WiFi is configured save configuration and reset the unit:

CONF:SAVE
*RST

Then wait for unit to reboot (and give it few seconds to connect to network).

We can use SYS:WIFI:STAT? command to check if BrickPico is now successfully connected to network:

SYS:WIFI:STAT?
1,192.168.1.200,255.255.255,0,192.168.1.1

When connected to network first field returned should be "1" (see command description for list of possible status codes).

Automated Monitoring

Web interface provides CSV and JSON formatted status output as well, to make it easier to automate status monitoring.

CSV Output

BrickPico status in comma separated values (CSV) format returns same output as Read? command from console.

URL: http://x.x.x.x/status.csv

For example:

$ curl http://192.168.1.200/status.csv
output1,"Main Lights",62,ON
output2,"Engine Lights",42,ON
output3,"Interior Lights",15,ON
output4,"Weapons",100,ON
output5,"Unused",15,OFF
output6,"Unused",15,OFF
output7,"Unused",15,OFF
output8,"Unused",15,OFF

JSON Output

BrickPico status in JSON format is available using following URL:

URL: http://x.x.x.x/status.json

For example:

$ curl http://192.168.1.200/status.json
{
	"outputs":	[{
			"output":	1,
			"name":	"Main Lights",
			"duty_cycle":	62,
			"state":	"ON"
		}, {
			"output":	2,
			"name":	"Engine Lights",
			"duty_cycle":	42,
			"state":	"ON"
		}, {
			"output":	3,
			"name":	"Interior Lights",
			"duty_cycle":	15,
			"state":	"ON"
		}, {
			"output":	4,
			"name":	"Weapons",
			"duty_cycle":	100,
			"state":	"ON"
		}, {
			"output":	5,
			"name":	"Unused",
			"duty_cycle":	15,
			"state":	"OFF"
		}, {
			"output":	6,
			"name":	"Unused",
			"duty_cycle":	15,
			"state":	"OFF"
		}, {
			"output":	7,
			"name":	"Unused",
			"duty_cycle":	15,
			"state":	"OFF"
		}, {
			"output":	8,
			"name":	"Unused",
			"duty_cycle":	15,
			"state":	"OFF"
		}]
}

Automated Control

It is possible to use scripts/programs to control BrickPico remotely via the web interface.

Operation URL Notes
All Outputs ON /cgi?pwrall=1 Turns on all outputs.
All Outputs OFF /cgi?pwrall=0 Turns off all outputs.
Single Output ON /cgi?pwrXX=1 Turn on output XX. (valid range for "XX": 01..08 or 01..16)
Single Output OFF /cgi?pwrXX=0 Turn off output XX.
Set Output PWM (Brightness) /cgi?pwmXX=n Set output XX PWM (duty-cycle) to n%.

To make changes make GET request to appropriate URL.

Examples

Turn all outputs OFF:

$ curl http://192.168.1.200/cgi?pwrall=0

Turn all outputs ON:

$ curl http://192.168.1.200/cgi?pwrall=1

Set output 2 to 25% duty cycle (brightness):

$ curl http://192.168.1.200/cgi?pwm02=25

Turn on output 2:

$ curl http://192.168.1.200/cgi?pwr02=1