ISR829 router wireless configuration with WPA-PSK encryption
1. Setup an IP address on the wlan-ap0 interface for integrated AP managment
2. Connect to the integrated AP (service-module wlan-ap0 session)
3. Configure the SSID with the following settings. Here is configured the SSID, the authentication mode, and the WPA-PSK key.
dot11 ssid TEST
authentication open
authentication key-management wpa
wpa-psk ascii 0 AZERTYUIOP
guest-mode
4. Configure the Dot11Radio0 interface with the following settings. Here is configured the encryption mode and the link with the previously configured SSID.
interface Dot11Radio0
no ip address
bridge-group 1
encryption mode ciphers aes-ccm
ssid TEST
5. Go back to the router configuration. The data path of the integrated AP is linked to the router's Wlan-GigabitEthernet0 interface (not the AP interface).
6.Configure the Wlan-GigabitEthernet0 interface as an access port in Vlan 1 :
interface Wlan-GigabitEthernet0
switchport mode access
7.Configure DHCP on the router for vlan 1 :
ip dhcp excluded-address 192.168.100.1 192.168.100.9
!
ip dhcp pool IoE_POOL
network 192.168.100.0 255.255.255.0
default-router 192.168.100.1
interface Vlan1
ip address 192.168.100.1 255.255.255.0
IoE MCU board registration
Add a wireless connector to the MCU board and configure wireless settings to connect it to the remote 829 router. On the config tab, configure the address of the remote IoE server (192.168.20.2) with the following user/password (user : register, password : register)
Javascript code for the MCU Board (remote fire sensors)
The IoEClient.setup(api) function sets up the API for remote monitor and control from IoE server. The api is an object describing the states reported by the IoE device and identifying the one remote controlable [controlable: true] by the server.
The IoEClient.reportStates(states) reports the states of this device to the IoE server. The argument is a string representing all states of this device. The argument can also be an array representing all states. The number of states must match the length of the states property in the IoEClient.setup() function.
function setup() {
pinMode(1, OUTPUT);
IoEClient.setup({
type: "Fire Detection",
states: [{
name: "Fire",
type: "bool"
},
{
name: "Temperature",
type: "number",
unit: "°C",
imperialUnit: "°F",
toImperialConversion: "x*1.8+32",
toMetricConversion: "(x-32)/1.8",
decimalDigits: 1
},
{
name: "Smoke Level",
type: "number",
unit: "ppm",
decimalDigits: 1
}]
});
}
function loop() {
var SmokeLevel = analogRead(A0);
var Temperature = analogRead(A1);
var FireDetected=false;
if (SmokeLevel>50 || Temperature>580) {
digitalWrite(0, HIGH);
FireDetected=true;
}
else {
digitalWrite(0, LOW);
FireDetected=false;
}
IoEClient.reportStates([FireDetected,Temperature,SmokeLevel]);
delay(500);
}
Javascript code for the SBC Board (visual fire alarm)
var state = 0;
function setup() {
IoEClient.setup({
type: "FireAlarm",
states: [{
name: "On",
type: "bool",
controllable: true
}]
});
IoEClient.onInputReceive = function(input) {
processData(input, true);
};
attachInterrupt(0, function() {
processData(customRead(0), false);
});
setState(state);
}
function processData(data, bIsRemote) {
if ( data.length <= 0 )
return;
setState(parseInt(data));
}
function setState(newState) {
state = newState;
if ( state === 0 )
digitalWrite(0, LOW);
else
digitalWrite(0, HIGH);
customWrite(0, state);
IoEClient.reportStates(state);
setDeviceProperty(getName(), "state", state);
}