https://nearbus.xyz/mediawiki/api.php?action=feedcontributions&user=Nearwiki&feedformat=atomNearwiki - User contributions [en]2024-03-29T01:30:23ZUser contributionsMediaWiki 1.30.0https://nearbus.xyz/mediawiki/index.php?title=MediaWiki:Common.css&diff=163MediaWiki:Common.css2018-03-29T22:38:34Z<p>Nearwiki: </p>
<hr />
<div>/* CSS placed here will be applied to all skins */<br />
<br />
/* remove Toolbox */<br />
#p-tb { display:none !important; }<br />
<br />
/* by ferdep 03-11-13 */<br />
.tocnumber { display: none; }</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=MediaWiki:Common.css&diff=162MediaWiki:Common.css2018-03-29T22:33:21Z<p>Nearwiki: </p>
<hr />
<div>/* CSS placed here will be applied to all skins */<br />
<br />
/* remove Toolbox */<br />
#p-tb { display:none !important; }<br />
<br />
/* by ferdep 03-11-13 */<br />
.tocnumber { display: none; }<br />
<br />
h1 { font-size: 20pt; }</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=MediaWiki:Common.css&diff=161MediaWiki:Common.css2018-03-29T21:42:55Z<p>Nearwiki: Created page with "/* CSS placed here will be applied to all skins */ /* remove Toolbox */ #p-tb { display:none !important; } /* by ferdep 03-11-13 */ .tocnumber { display: none; }"</p>
<hr />
<div>/* CSS placed here will be applied to all skins */<br />
<br />
/* remove Toolbox */<br />
#p-tb { display:none !important; }<br />
<br />
/* by ferdep 03-11-13 */<br />
.tocnumber { display: none; }</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=NearBios_Services&diff=160NearBios Services2018-03-29T21:23:30Z<p>Nearwiki: Created page with "<br /> File:Near_bios.png <br /> ----"</p>
<hr />
<div><br /><br />
[[File:Near_bios.png]]<br />
<br /><br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Resistors_Color_Code&diff=159Resistors Color Code2018-03-29T21:23:01Z<p>Nearwiki: Created page with "800px"</p>
<hr />
<div>[[File:Resistor_color_codes.jpg|800px]]</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Atmega_328_Pinout&diff=158Atmega 328 Pinout2018-03-29T21:22:36Z<p>Nearwiki: Created page with "800px"</p>
<hr />
<div>[[File:ATM328_arduino_pinout.jpg|800px]]</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Asc_II_Table&diff=157Asc II Table2018-03-29T21:22:10Z<p>Nearwiki: Created page with "1000px"</p>
<hr />
<div>[[File:AscII_0.png|1000px]]</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Arduino_4_Power_Relay_Shield&diff=156Arduino 4 Power Relay Shield2018-03-29T21:19:56Z<p>Nearwiki: Created page with " ===Characteristics === <br /> * '''4 Power Relays:''' 220Vac 10A (each can manage power loads up to 2200 Watts) * '''Indicator LEDs''' * '''Arduinos Shield form factor'''..."</p>
<hr />
<div><br />
===Characteristics ===<br />
<br /><br />
<br />
* '''4 Power Relays:''' 220Vac 10A (each can manage power loads up to 2200 Watts)<br />
<br />
* '''Indicator LEDs'''<br />
<br />
* '''Arduinos Shield form factor'''<br />
<br />
* '''Works on pins 4-5-6-7'''<br />
<br />
* '''Supplier Web:''' [http://www.seeedstudio.com/wiki/Relay_Shield_V2.0] <br />
<br />
<br />
<br />
----<br />
<br />
===Grove Power Relay===<br />
<br /><br />
<br />
[[File:arduino_4relay_shield.jpg]]<br />
<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=OpenPicus_Grove_Shield&diff=155OpenPicus Grove Shield2018-03-29T21:19:30Z<p>Nearwiki: Created page with " ===Main Characteristics=== <br /> * Reseller: OpenPicus - http://store.openpicus.com/openpicus/prodotti.aspx?cprod=OP015384 * Serial programmer onboard connector * MicroSD..."</p>
<hr />
<div><br />
===Main Characteristics===<br />
<br /><br />
<br />
* Reseller: OpenPicus - http://store.openpicus.com/openpicus/prodotti.aspx?cprod=OP015384<br />
<br />
* Serial programmer onboard connector<br />
<br />
* MicroSD card connector onboard for datalogging<br />
<br />
* 4 Digital, 3 Analog, 1 SPI, 1 I2C<br />
<br />
* 2 inputs for Interrupts<br />
<br />
* 3,7V battery input (battery not included)<br />
<br />
<br />
----<br />
<br />
===OpenPicus Grove Shield===<br />
<br /><br />
<br />
<br />
[[File:Openpicus_grove.png|400px]]<br />
<br />
<br />
<br />
----<br />
===Board Connectors Layout===<br />
<br /><br />
<br />
<br />
[[File:openpicus_grove_nest.png|600px]]</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Arduino_Grove_Shield&diff=154Arduino Grove Shield2018-03-29T21:19:01Z<p>Nearwiki: Created page with " * Base Shield V1.3 - Grove compatible - http://seeedstudio.com/depot/base-shield-v13-p-1378.html * Pin Out arduino compatible * 4 Digital Ports (4 wire Grove connectors)..."</p>
<hr />
<div><br />
<br />
* Base Shield V1.3 - Grove compatible - http://seeedstudio.com/depot/base-shield-v13-p-1378.html<br />
<br />
* Pin Out arduino compatible<br />
<br />
* 4 Digital Ports (4 wire Grove connectors)<br />
<br />
* 4 Analog Ports (4 wire Grove connectors)<br />
<br />
* 4 I2C Ports (4 wire Grove connectors)<br />
<br />
* Power indicator LED and Reset Buttons (useful:) <br />
<br />
<br />
<br />
----<br />
<br />
===Arduino Base Shield===<br />
<br /><br />
<br />
[[File:Grove_base_shield.jpg]]<br />
<br />
<br />
<br />
----<br />
<br />
===Board Connectors Layout===<br />
<br /><br />
<br />
[[File:Grove_base_shield_connectors.jpg]]</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Grove_Power_Relay&diff=153Grove Power Relay2018-03-29T21:18:27Z<p>Nearwiki: Created page with " ===Characteristics === <br /> * '''Power Relay:''' 220Vac 10A (it can manage power loads up to 2200 Watts) * '''Indicator LED''' * '''Dimension:''' 42.0 x 24.0 x 19.5 [m..."</p>
<hr />
<div><br />
===Characteristics ===<br />
<br /><br />
<br />
* '''Power Relay:''' 220Vac 10A (it can manage power loads up to 2200 Watts)<br />
<br />
* '''Indicator LED'''<br />
<br />
* '''Dimension:''' 42.0 x 24.0 x 19.5 [mm]<br />
<br />
<br />
<br />
----<br />
<br />
===Grove Power Relay===<br />
<br /><br />
<br />
<br />
[[File:Grove_relay.png]]<br />
<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Moisture_Sensor&diff=152Moisture Sensor2018-03-29T21:17:48Z<p>Nearwiki: Created page with " * '''Product Web:''' http://www.seeedstudio.com/depot/grove-moisture-sensor-p-955.html * '''Wiki:''' http://seeedstudio.com/wiki/Grove_-_Moisture_Sensor * '''Code Source:'..."</p>
<hr />
<div><br />
<br />
* '''Product Web:''' http://www.seeedstudio.com/depot/grove-moisture-sensor-p-955.html<br />
<br />
* '''Wiki:''' http://seeedstudio.com/wiki/Grove_-_Moisture_Sensor<br />
<br />
* '''Code Source:''' n/a<br />
<br />
* '''Technical Spec:''' Humidytly: 5% RH - 99% RH - Temperature -40°C - 80°C - Acuracy: 2% RH / 0.5°C<br />
<br />
* '''Connector Type:''' Base Shield V1.3 - Grove compatible - http://seeedstudio.com/depot/base-shield-v13-p-1378.html<br />
<br />
<br />
<br />
----<br />
<br />
===Grove Moisture Sensor===<br />
<br /><br />
<br />
[[File:moisture_sensor.jpg]]<br />
<br />
<br />
<br />
<br />
===Grove Moisture Circuit===<br />
<br /><br />
[[File:Moisture_sensor_circuit.jpg]]<br />
<br />
<br />
<br />
----<br />
<br />
===MyNbios Code - Example===<br />
<br /><br />
<br />
'''In order to run this code you should copy the following code into the area delimited by the MY_NBIOS CUSTOM CODE banners in the Hello_World_xxx.ino example.''' <br />
<br />
<pre><br />
void Nearbus::MyNbios_0( byte portId, ULONG setValue, ULONG* pRetValue, byte vmcuMethod, PRT_CNTRL_STRCT* pPortControlStruct )<br />
{<br />
<br />
//************************************<br />
// Reconfiguring Ports as I/O<br />
//************************************<br />
if( pPortControlStruct->portMode != MYDRIVER_ODE ) <br />
{<br />
PortModeConfig( portId, MYDRIVER_MODE ); <br />
}<br />
<br />
//************************************<br />
// Custom Function<br />
//************************************<br />
// DEFAULT: The default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)<br />
// INTERNAL: An built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)<br />
// INTERNAL1V1: A built-in 1.1V reference (Arduino Mega only)<br />
// INTERNAL2V56: A built-in 2.56V reference (Arduino Mega only)<br />
// EXTERNAL: The voltage applied to the AREF pin (0 to 5V only) is used as the reference. <br />
<br />
<br />
analogReference( DEFAULT ); <br />
<br />
*pRetValue = (ULONG) analogRead( pPortControlStruct->anaPinId ); <br />
<br />
}<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Temperature_%26_Humidity_Sensor_Pro&diff=151Temperature & Humidity Sensor Pro2018-03-29T21:17:11Z<p>Nearwiki: Created page with " * '''Product Web:''' http://seeedstudio.com/depot/grove-temperaturehumidity-sensor-pro-p-838.html?cPath=25_27 * '''Wiki:''' http://seeedstudio.com/wiki/Grove_-_Temperature_..."</p>
<hr />
<div><br />
<br />
* '''Product Web:''' http://seeedstudio.com/depot/grove-temperaturehumidity-sensor-pro-p-838.html?cPath=25_27<br />
<br />
* '''Wiki:''' http://seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro<br />
<br />
* '''Code Source:''' http://seeedstudio.com/wiki/File:Humidity_Temperature_Sensor.zip<br />
<br />
* '''Technical Spec:''' Humidytly: 5% RH - 99% RH - Temperature -40°C - 80°C - Acuracy: 2% RH / 0.5°C<br />
<br />
* '''Connector Type:''' Base Shield V1.3 - Grove compatible - http://seeedstudio.com/depot/base-shield-v13-p-1378.html<br />
<br />
<br />
<br />
----<br />
===Temperature & Humidity Sensor Pro===<br />
<br /><br />
<br />
[[File:Grove_Tem_Humid.jpg]]<br />
<br />
<br />
<br />
----<br />
<br />
=== MyNbios Code - Example ===<br />
<br /><br />
<br />
'''In order to run this code you should copy the following code into the area delimited by the MY_NBIOS CUSTOM CODE banners in the Hello_World_xxx.ino example.'''<br />
<br />
<br />
<pre><br />
void Nearbus::MyNbios_0( byte portId, UINT setValue, ULONG* pRetValue, byte vmcuMethod, PRT_CNTRL_STRCT* pPortControlStruct )<br />
{ <br />
UINT data[6];<br />
UINT _pin;<br />
UINT _count = 6;<br />
ULONG _lastreadtime = 0;<br />
boolean firstreading = true;<br />
float h;<br />
float t; <br />
byte ret;<br />
UINT laststate = HIGH;<br />
UINT counter = 0;<br />
UINT j = 0;<br />
UINT i;<br />
ULONG currenttime;<br />
<br />
//************************************<br />
// Reconfiguring Ports as I/O<br />
//************************************<br />
if( pPortControlStruct->portMode != MYDRIVER_MODE ) <br />
{<br />
PortModeConfig( portId, MYDRIVER_MODE ); <br />
}<br />
<br />
//************************************<br />
// Custom Function<br />
//************************************<br />
_pin = pPortControlStruct->pinId;<br />
<br />
// pull the pin high and wait 250 milliseconds<br />
digitalWrite(_pin, HIGH);<br />
delay(250);<br />
<br />
currenttime = millis();<br />
if (currenttime < _lastreadtime) {<br />
// ie there was a rollover<br />
_lastreadtime = 0;<br />
}<br />
if (!firstreading && ((currenttime - _lastreadtime) < 2000)) {<br />
ret = 0; // return last correct measurement<br />
//delay(2000 - (currenttime - _lastreadtime));<br />
}<br />
else {<br />
firstreading = false;<br />
_lastreadtime = millis();<br />
<br />
data[0] = data[1] = data[2] = data[3] = data[4] = 0;<br />
<br />
// now pull it low for ~20 milliseconds<br />
pinMode(_pin, OUTPUT);<br />
digitalWrite(_pin, LOW);<br />
delay(20);<br />
cli();<br />
digitalWrite(_pin, HIGH);<br />
delayMicroseconds(40);<br />
pinMode(_pin, INPUT);<br />
<br />
// read in timings<br />
for ( i=0; i< 85; i++) { // #define MAXTIMINGS = 85 // how many timing transitions we need to keep track of. 2 * number bits + extra<br />
counter = 0;<br />
while (digitalRead(_pin) == laststate) {<br />
counter++;<br />
delayMicroseconds(1);<br />
if (counter == 255) {<br />
break;<br />
}<br />
}<br />
laststate = digitalRead(_pin);<br />
<br />
if (counter == 255) break;<br />
<br />
// ignore first 3 transitions<br />
if ((i >= 4) && (i%2 == 0)) {<br />
// shove each bit into the storage bytes<br />
data[j/8] <<= 1;<br />
if (counter > _count)<br />
data[j/8] |= 1;<br />
j++;<br />
}<br />
}<br />
sei();<br />
<br />
// check we read 40 bits and that the checksum matches<br />
if ((j >= 40) && <br />
(data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF)) ) {<br />
ret = 0;<br />
}<br />
else{<br />
ret = 1;<br />
}<br />
}<br />
if (ret == 0) {<br />
h = data[0];<br />
h *= 256;<br />
h += data[1];<br />
h *= 10;<br />
<br />
t = data[2] & 0x7F;<br />
t *= 256;<br />
t += data[3];<br />
t *= 10;<br />
if (data[2] & 0x80)<br />
t *= -1;<br />
}<br />
else {<br />
t = 0;<br />
h = 0; <br />
} <br />
// delay(250); <br />
<br />
//************************************<br />
// Updating register <br />
//************************************ <br />
* pRetValue = (ULONG) t; <br />
}<br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=One-Wire_Temperature_Sensor_-_DS18B20&diff=150One-Wire Temperature Sensor - DS18B202018-03-29T21:16:38Z<p>Nearwiki: Created page with " === Reference Information === <br /> * '''Info Web:''' http://seeedstudio.com/depot/one-wire-temperature-sensor-p-1235.html?cPath=25_27 * '''Techinical Spec:''' Temperature..."</p>
<hr />
<div><br />
=== Reference Information ===<br />
<br /><br />
* '''Info Web:''' http://seeedstudio.com/depot/one-wire-temperature-sensor-p-1235.html?cPath=25_27<br />
<br />
* '''Techinical Spec:''' Temperature range: -55°C to +125°C - Accuracy: ±0.5°C( -10°C to +85°C)<br />
<br />
* '''Connector Type:''' Base Shield V1.3 - Grove compatible - http://seeedstudio.com/depot/base-shield-v13-p-1378.html<br />
<br />
* '''Code Source:''' http://playground.arduino.cc/Learning/OneWire<br />
<br />
<br />
<br />
----<br />
<br />
===Temperature Sensor - DS18B20 - (Waterproof)===<br />
<br /><br />
[[File:Temp probe 18B20.jpg]]<br />
<br />
<br />
<br />
----<br />
<br />
=== MyNbios Code - Example ===<br />
<br /><br />
<br />
'''In order to run this code you should copy the following code into the area delimited by the MY_BIOS CUSTOM CODE banners in the Hello_World_xxx.ino example.'''<br />
<br />
<pre><br />
<nowiki>#include <OneWire.h></nowiki><br />
<br />
OneWire ds(3); // Arduino PIN_3<br />
<br />
void Nearbus::MyNbios_0( byte portId, ULONG setValue, ULONG* pRetValue, byte vmcuMethod, PRT_CNTRL_STRCT* pPortControlStruct )<br />
{<br />
byte i;<br />
byte present = 0;<br />
byte type_s;<br />
byte data[12];<br />
byte addr[8];<br />
float celsius, fahrenheit;<br />
<br />
for (i=0 ; i < 20 ; i++) {<br />
if ( ds.search(addr)) {<br />
break;<br />
}<br />
ds.reset_search();<br />
delay(250); <br />
}<br />
if (i == 20 ) {<br />
*pRetValue = 0; <br />
return;<br />
}<br />
<br />
if(OneWire::crc8(addr, 7) != addr[7]) {<br />
*pRetValue = 0;<br />
return;<br />
}<br />
<br />
// the first ROM byte indicates which chip<br />
switch (addr[0]) {<br />
case 0x10:<br />
type_s = 1;<br />
break;<br />
<br />
case 0x28:<br />
type_s = 0;<br />
break;<br />
<br />
case 0x22:<br />
type_s = 0;<br />
break;<br />
<br />
default:<br />
*pRetValue = 0;<br />
return;<br />
} <br />
ds.reset();<br />
ds.select(addr);<br />
ds.write(0x44, 1); // start conversion, with parasite power on at the end<br />
delay(1000); // maybe 750ms is enough, maybe not<br />
present = ds.reset();<br />
ds.select(addr); <br />
ds.write(0xBE); // Read Scratchpad<br />
<br />
for ( i = 0; i < 9; i++) { // we need 9 bytes<br />
data[i] = ds.read();<br />
}<br />
<br />
int16_t raw = (data[1] << 8) | data[0];<br />
if (type_s) {<br />
raw = raw << 3; // 9 bit resolution default<br />
if (data[7] == 0x10) { // "count remain" gives full 12 bit resolution<br />
raw = (raw & 0xFFF0) + 12 - data[6];<br />
}<br />
} <br />
else {<br />
byte cfg = (data[4] & 0x60);<br />
// at lower res, the low bits are undefined, so let's zero them<br />
if (cfg == 0x00) raw = raw & ~7; // 9 bit resolution, 93.75 ms<br />
else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms<br />
else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms<br />
// default is 12 bit resolution, 750 ms conversion time<br />
}<br />
celsius = (float)raw / 16.0;<br />
fahrenheit = celsius * 1.8 + 32.0; <br />
<br />
if ( !setValue ) { // NearAPI: [value=1] => Fahrenheit - [value=0] => Celsius<br />
*pRetValue = (ULONG) (celsius * 100);<br />
}<br />
else {<br />
*pRetValue = (ULONG) (fahrenheit * 100);<br />
} <br />
}<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Grove_Modules_Guide&diff=149Grove Modules Guide2018-03-29T21:16:03Z<p>Nearwiki: Created page with " ===Grove - Modules Data Sheet Index === Grove Modules Data Sheet: [http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.1b] ---- ===Grove - Temperature Sensor=== Produc..."</p>
<hr />
<div><br />
===Grove - Modules Data Sheet Index ===<br />
<br />
Grove Modules Data Sheet: [http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.1b]<br />
<br />
<br />
----<br />
===Grove - Temperature Sensor===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor]<br />
<br />
[[File:grove_temperature_sensor.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Light Sensor===<br />
<br />
Product datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Light_Sensor]<br />
<br />
[[File:grove_light_sensor.jpg|250px]]<br />
<br />
<br />
----<br />
===Grove - Barometer Sensor===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Barometer_Sensor]<br />
<br />
[[File:grove_barometer_sensor.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Electricity Sensor===<br />
<br />
'''Product Datasheet:''' [http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor]<br />
<br />
'''Characteristics:''' Maximum Input Current: 5 A - (output 2V)<br />
<br />
[[File:grove_twig_electricity_Sensor.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Infrared Emitter===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Infrared_Emitter]<br />
<br />
[[File:grove_infrared_emitter.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - LED Socket Kit===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_LED]<br />
<br />
[[File:grove_grove_led.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Relay===<br />
<br />
'''Product Datasheet:''' [http://www.seeedstudio.com/wiki/Grove_-_Relay]<br />
<br />
'''Characteristics:''' 7A - 250Vac ( Max: 1500 Watts - Resistive load)<br />
<br />
[[File:grove_twig_relay.jpg|200px]]<br />
<br />
<br />
----<br />
<br />
===Grove - Rotary Angle Sensor===<br />
<br />
'''Product Datasheet:''' [http://www.seeedstudio.com/wiki/Grove_-_Rotary_Angle_Sensor]<br />
<br />
'''Characteristics:''' 10K linear potentiometer.<br />
<br />
[[File:grove_potentiometer.jpg|200px]]<br />
<br />
<br />
----<br />
<br />
===Grove - Slide Potentiometer===<br />
<br />
'''Product Datasheet:''' [http://www.seeedstudio.com/wiki/Grove_-_Slide_Potentiometer]<br />
<br />
'''Characteristics:''' 10K linear potentiometer.<br />
<br />
[[File:grove_sliding_potentiometer.jpg|200px]]<br />
<br />
<br />
----<br />
<br />
===Grove - Screw Terminal===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Screw_Terminal]<br />
<br />
[[File:grove_screw_terminal.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Button===<br />
<br />
'''Product Datasheet:''' [http://www.seeedstudio.com/wiki/Grove_-_Button]<br />
<br />
'''Characteristics:''' Button with pull-down resistor (it normally outputs LOW).<br />
<br />
[[File:grove_button.jpg|200px]]<br />
<br />
<br />
----<br />
<br />
===Grove - Buzzer===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Buzzer]<br />
<br />
[[File:grove_buzzer.jpg|200px]]<br />
<br />
<br />
----<br />
===Grove - Tilt Switch===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Grove_-_Tilt_Switch]<br />
<br />
[[File:grove_tilt.jpg|200px]]<br />
<br />
<br />
----<br />
===Non-invasive AC Current Sensor (30A max)===<br />
<br />
Product Datasheet: [http://www.seeedstudio.com/wiki/Non-invasive_AC_current_sensor%2830A_max%29]<br />
<br />
[[File:non_invasive_ac_current_sensor.jpg|200px]]<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Hardware_Resources&diff=148Hardware Resources2018-03-29T21:15:22Z<p>Nearwiki: Created page with " ===Arduino Ethernet Shield (Clonic)=== This cheap clonic Arduino Shield (around 10$ shipping included) has been tested by us and works Ok. It represents a great option if yo..."</p>
<hr />
<div><br />
===Arduino Ethernet Shield (Clonic)===<br />
<br />
This cheap clonic Arduino Shield (around 10$ shipping included) has been tested by us and works Ok. It represents a great option if you want to connect your Arduino to Internet and you can wait 7 days (its estimated delivery time). <br />
<br /><br />
<br /><br />
'''Where to Buy (Dealextreme):''' [http://dx.com/p/ethernet-shield-with-wiznet-w5100-ethernet-chip-tf-slot-118061]<br />
<br /><br />
<br /><br />
[[File:hw_sol_ether_shield.jpg|250px]]<br />
<br /><br />
<br /><br />
<br /><br />
----<br />
<br />
===Ethernet Power Injector (pasive cable)===<br />
<br /><br />
This adapter represents a cheap and easy to implement alternative to feed an Arduino (or another Ethernet device, like an Access Point) through an Ethernet cable (up to FE-100Mbps - CAT 5).<br />
<br /><br />
<br /><br />
'''Where to Buy (Dealextreme)''': [http://dx.com/es/p/rj45-network-connector-female-to-rj45-male-plug-dc-5-5mm-female-male-adapter-cable-black-2-pcs-216793] <br />
<br /><br />
[[File:rj45_poe.jpg|250px]]<br />
<br /><br />
----<br />
<br />
===Mini Power Supplies ( 220V / 5V)===<br />
<br /><br />
<br />
[[File:Mini_power_supply.png|300px]]<br />
<br />
<br />
'''90V~240VAC Input, 5VDC Output ,high and low voltage isolation'''<br />
<br />
<br />
'''Reference Information'''<br />
<br />
* '''Where to buy (eBay):''' [http://www.ebay.es/itm/AC-90-240V-to-5V-DC-Electronic-Voltage-Regulator-Switch-Power-Converter-600mA-3W-/370884897413?pt=LH_DefaultDomain_0&hash=item565a766a85]<br />
<br />
<br />
* Mounting dimensions: 40mm x 15mm<br />
* Input voltage: 90V to 240V AC (full load)<br />
* Input Current: 0.0273 (AC 110V) 0.014 (AC 220V)<br />
* Output voltage: 5V (±0.1V)<br />
* Output Current: 0A to 650mA, peak 800mA<br />
* Output power: 3W Maximum 3.5W<br />
* Output efficiency: 85%<br />
* Output ripple: 150mv<br />
* Operating temperature: -20 to 60 °c<br />
* Protections: Output power - Shortage - Temperature - Overcurrent: (lock, restart recovery)<br />
<br />
<br />
----<br />
<br />
===Industrial Power Supplies - DIN Rail===<br />
<br /><br />
<br />
[[File:Tdk_lambda_dsp5_1.jpg|200px]]<br />
<br />
<br />
'''TDK LAMBDA - DSP10-5 - AC-DC CONV, DIN RAIL, 1 O/P, 7.5W, 1.5A, 5V '''<br />
<br />
<br />
'''Reference Information'''<br />
<br />
* AC-DC CONV, DIN RAIL, 1 O/P, 7.5W, 1.5A, 5V<br />
* Power Supply Output Type: Fixed<br />
* Input Voltage VAC: 90V to 264V<br />
* Output Voltage Nom.: 5V<br />
* Output Current Max: 1.5A<br />
* Output Power Max: 7.5W<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1248_-_Power_Meter&diff=147App Note 1248 - Power Meter2018-03-29T21:14:34Z<p>Nearwiki: Created page with " This App Note shows how to control and measure a power load in a simple way under the NearBus System. ===Demostrative Video=== <br /> <html><iframe width="480" height="360"..."</p>
<hr />
<div><br />
This App Note shows how to control and measure a power load in a simple way under the NearBus System.<br />
<br />
<br />
===Demostrative Video===<br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/QcBm-nSuebw?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br />
<br />
----<br />
<br />
===Required Components===<br />
<br /><br />
<br />
To implement this App Note you will need:<br />
<br />
'''- 1 Arduino Ethernet Board'''<br />
<br />
'''- 1 Arduino Grove Shield''' [http://nearbus.org/wiki/index.php?title=Arduino_Grove_Shield]<br />
<br />
'''- 1 Arduino Relay Shield'''<br />
<br />
'''- 1 Current Transformer'''<br />
<br />
'''- 1 Resistive Power Load - (aprox. 500W)'''<br />
<br />
<br />
<br />
<br />
[[File:app_note_1248_components.png]]<br />
<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1211_-_XMAS_Internet_Sequencer&diff=146App Note 1211 - XMAS Internet Sequencer2018-03-29T21:14:02Z<p>Nearwiki: Created page with " This App Note describes how to implement a large XMAS light sequencer (for a small neighbourhood or across different countries) using an Arduino implementation of NearBus sy..."</p>
<hr />
<div><br />
This App Note describes how to implement a large XMAS light sequencer (for a small neighbourhood or across different countries) using an <br />
Arduino implementation of NearBus system. This implementation will allow you to manage up to 16 lights from the web with a precision of 100 ms that provides enough capacity to implement powerful light effects at large scale.<br />
<br />
<br />
The following video shows a implementation with three Arduino platforms (Ethernet) synchronized independently (from a remote NearHub) with a time slot of 250 ms. Because there are 4 lights in this example, two Arduinos uses one channel and the third uses two channels. The lights are switched on or off by a modified plugable outlet (with internal micro-relay)<br />
<br /><br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/4ihql972DsY?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br />
<br />
<br />
===How does it work?===<br />
<br /><br />
This implementation allows you to control up to 16 independent light systems connecting each to a different NearBus Agent. The Agents are not linked together, instead they are only linked through Internet to the NearHub. To synchronize each light system the NearBIOS implements a pseudo NTP system that allows to synchronize all the agents with a precision about 100 ms. The Web Interface should be used in shared mode (between multiple users) to simplify the interaction when the light sequence is defined.<br />
<br />
<br />
<br />
[[File:xmas_sequencer_1.png|470px]]<br />
<br />
<br />
<br />
<br />
===Remarks===<br />
<br />
* This implementation has been designed to be simple to deploy. It only requires an Arduino Ethernet platform and a simple relay electronic driver (to control the power light system).<br />
<br />
* This is a DIY project, so we do not sell any of the special components that are shown in this application note.<br />
<br />
* This App Note is intended to be used with educational or experimental purposes and should not be used in professional environments. <br />
<br />
<br />
----<br />
<br />
===Implementation Steps===<br />
<br /><br />
To implement the XMAS Internet sequencer you only need an Arduino Ethernet platform (Arduino Ethernet or Arduino UNO, Leonardo, etc + Ethernet Shield). Additionally to control the power light system you will have to implement the electronic relay driver system. <br />
<br />
<br />
<br />
[[File:xmas_sequencer_2.jpg|450px]]<br />
<br />
<br />
<br />
In this picture you can see the power switches, they have been implemented by modifying a simple plugable outlet (with internal micro-relay).<br />
<br />
<br />
----<br />
<br />
===STEP 1 - Sing Up a new NearBus account===<br />
<br /><br />
Because this specific App usually will require a group of users, we recommend to define a shared account, and manage it between all the users to simplify the configuration process.<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 2- Download the Agent code library===<br />
<br /><br />
Download the Arduino NearBus library from the download menu. Because this is a beta release the only one supported platform is Arduino Ethernet.<br />
<br />
<br />
----<br />
<br />
===STEP 3- Set Up the new devices in the NearBus Data Base===<br />
<br /><br />
The "New Device" menu will allow you to activate the devices in the NearBus system. When you generate a new device the system will give you a new "device_Id". This device_Id identifies your device in a unique way (like a MAC) so you will need to set this device_Id (and the shared secret) in the Arduino code before uploading it to the board.<br />
<br />
<br />
----<br />
<br />
===STEP 4- Update the Agent code in each Arduino platform===<br />
<br /><br />
Set up the right "device_Id", "shared_secret", and Ethernet MAC address before uploading the Agent code in each Arduino board.<br />
<br />
<br />
----<br />
===STEP 5- Connect the light system to the Arduino Agent===<br />
<br /><br />
This Beta release of NearBIOS supports up to 4 channels on the Arduino agent. For this App you only need to connect the "digital pins" of Arduino. The chart below shows the assigned pin for each channel:<br />
<br />
<br />
{| cellpadding="5" cellspacing="0" border="1"<br />
|Channel 0<br />
|Dig_pin 3<br />
|-<br />
|Channel 1<br />
|Dig_pin 5<br />
|-<br />
|Channel 2<br />
|Dig_pin 6<br />
|-<br />
|Channel 3<br />
|Dig_pin 9<br />
|}<br />
<br />
<br />
<br />
You should connect so many channels as light systems you want to connect over each Agent (from 1 to 4).<br />
<br />
'''Note:''' as usual, to control a power light system you need to implement a power driver. The simplest solution is to use an electromechanical relay driven by a small transistor. In the Help section you can find a diagram of this simple circuit.<br />
<br />
The following picture shows the trivial implementation of a four channel NearBus Agent with Arduino Ethernet (there are no active components in this prototype, it only has four audio jacks directly wired (Vcc, GND, Signal ) to the Arduino board ).<br />
<br />
<br />
<br />
<br />
[[File:xmas_sequencer_3.jpg|300px]]<br />
<br />
<br />
----<br />
<br />
===STEP 6- Verify that all devices are UP===<br />
<br /><br />
<br />
The "device list" menu will show you the device state (UP or DOWN). Be sure that all devices are in UP state.<br />
<br />
<br />
<br />
[[File:xmas_sequencer_4.png|350px]]<br />
<br />
----<br />
<br />
===STEP 7- Configure the Sequencer Chart===<br />
<br /><br />
The "Sequencer" menu allows you to configure the desired sequence. You should define the device and the channel that will control the sequenced light. The following screen shot shows the sequencer configuration screen:<br />
<br />
<br />
[[File:xmas_sequencer_5.png|450px]]<br />
<br />
<br />
----<br />
<br />
===STEP 8- Start the sequencer system===<br />
<br /><br />
Select the RUN option in the configuration screen and refresh it. The system takes a few seconds to be synchronized and fully operative.<br />
<br />
<br />
For detailed information about how to implement and configure this AppNote, please contact us at: '''info@nearbus.net'''</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1220_-_Cloud_PLC&diff=145App Note 1220 - Cloud PLC2018-03-29T21:13:23Z<p>Nearwiki: Created page with "This App Note describes how to implement a Cloud PLC (Programmable Logic Controller), using the NearBus basic building components. File:cloud_plc_1.png === Overview=..."</p>
<hr />
<div>This App Note describes how to implement a Cloud PLC (Programmable Logic Controller), using the NearBus basic building components.<br />
<br />
<br />
<br />
[[File:cloud_plc_1.png]]<br />
<br />
<br />
<br />
=== Overview===<br />
<br /><br />
'''Note:''' The system described is not intended to replace an industrial PLC control system, however this basic architecture offers some PLC features than can be useful in experimental or non-critical applications.<br />
<br />
<br />
The cloud PLC architecture has been designed to be easy and cheap to implement (all the components used in the following examples are off-the-shelf components). <br />
<br />
<br />
<br />
[[File:cloud_plc_2.png]]<br />
<br />
<br />
The main feature of this system is its standard industrial form factor. All components are designed to be implemented over a DIN rail mounting enclosure, and the circuits have been designed using off-the-shelf components.<br />
<br />
For its implementation this app note needs some basics electronics skills and knowledge. <br />
<br />
<br />
<br />
----<br />
<br />
===SYSTEM DESCRIPTION===<br />
<br /><br />
<br />
The system has two main components, the Controller Module and the Drivers.<br />
<br />
<br />
<br />
<br />
====The Controller====<br />
<br /><br />
<br />
The controller is the main component in the Cloud PLC system. The controller consist basically of a microcontroller board (Arduino Ethernet for example), wired to a output following a NearBus typical pin-out.<br />
<br />
The following picture shows a basic configuration example of a Controller module (Arduino Ethernet) and a standard PIR Driver<br />
<br />
<br />
<br />
[[File:cloud_plc_3.png]]<br />
<br />
<br />
<br />
----<br />
<br />
====The Drivers====<br />
<br /><br />
<br />
The drive modules are the electronic devices that make the adaptation function between the external signals and the microcontroller signals. Its functions include:<br />
<br />
- To adapt the electrical levels.<br />
<br />
- To isolate the microcontroller from dangerous signal levels (overtension, peak, etc.).<br />
<br />
- To transform the I/O signals from/to different sensors or actuators to digital microprocessor compatible signals (digital or analog). <br />
<br />
<br />
<br />
<br />
[[File:cloud_plc_4.png]]<br />
<br />
<br />
<br />
The drivers contain all the specific electronic needed to reach these functions. The electronic circuits have been designed to be cheap and easy to implement. They are mainly built using traditional analog electronic components (fully available in the market).<br />
<br />
The following picture shows the basic support board and the NearBus pin-out assignment (note that each port represents only one microcontroller digital or analog I/O ) and a Vcc / GND connection (is important to remark than this 3 pin trivial configuration is enough for most of the practical implementations and offers a huge flexibilty at configuration time). <br />
<br />
<br />
<br />
[[File:cloud_plc_5.png]]<br />
<br />
<br />
<br />
----<br />
<br />
====Remarks====<br />
<br /><br />
<br />
The NearBus system has been designed as an open HW platform, under this philosophy each component in the NearBus project has been thought to be useful by itself.<br />
<br />
For example the drivers in most of the cases are simple transducers that deliver a single signal to the controller (eg. temperature sensor) however they could be used alone in another system like feeding a conventional temperature display.<br />
<br />
On the other hand the controller is basically an Arduino Ethernet board mounted into a DIN enclosure in order to simplify its mounting and wiring. This solution could be used for example with a conventional Arduino Uno board in standalone system that will not require a network connection (like an industrial data logger).<br />
<br />
<br />
When needed we will include the circuit drawing in order to help you to understand how it works. <br />
<br />
<br />
<br />
----<br />
<br />
====Dribvers List====<br />
<br /><br />
The following list describes some of the main Drivers (sensors / transducers) that have been implemented in different NearBus scenarios.<br />
<br />
<br />
{| cellpadding="5" cellspacing="0" border="1"<br />
|True RMS Current Meter (input)<br />
|Input<br />
|-<br />
|Power Dimmer<br />
|Output<br />
|-<br />
|Power Relay (output)<br />
|Output<br />
|-<br />
|Digital Input<br />
|Input<br />
|-<br />
|PWM Output (Servo Motor)<br />
|Output<br />
|-<br />
|Temperature Sensor - Lineal<br />
|Input<br />
|-<br />
|Temperature Sensor - Thermocouple<br />
|Input<br />
|-<br />
|Temperature Sensor - Termistor<br />
|Input<br />
|-<br />
|Energy Counter (pulse Counter)<br />
|Input<br />
|-<br />
|Infra Red Repeater (output)<br />
|Output<br />
|-<br />
|PIR Detector (input)<br />
|Input<br />
|-<br />
|Resistance Meter (input)<br />
|Input<br />
|-<br />
|RGB LED Controller (output)<br />
|Output<br />
|-<br />
|Anemometer (Wind Speed)<br />
|Input<br />
|-<br />
|Level Sensor (input)<br />
|Input<br />
|-<br />
|Position Switch Sensor<br />
|Input<br />
|}<br />
<br />
<br />
<br />
If you are interested in knowing more about this App Note please contact us at: '''info@nearbus.net'''<br />
<br />
<br />
----<br />
<br />
(*) This initial trial release has been deployed only for the Arduino Ethernet platform. We are deploying new Agent libraries for another Arduino boards and platforms with Ethernet and Wi-Fi connectivity.</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1238_-_Twitter_Connector&diff=144App Note 1238 - Twitter Connector2018-03-29T21:12:52Z<p>Nearwiki: Created page with " This App Note describes how to implement a presence simulator controlled from the Cloud. The system consists in a combination of different internet free services as Twitter a..."</p>
<hr />
<div><br />
This App Note describes how to implement a presence simulator controlled from the Cloud. The system consists in a combination of different internet free services as Twitter and IFTTT (www.ifttt.com). An Arduino Ethernet board is used to control a power switch to turn on and turn off a light. This design is intended to show you how the NearBus Connector simplifies the way in which these kind of Internet-based projects can be implemented.<br />
<br />
<br />
[[File:Presence_sim_1.png]]<br />
<br />
<br />
===Overview===<br />
<br /><br />
As showed in the last picture the system consists of an Internet configurable clock that sends ON / OFF messages through Twitter to the NearBus connector. The NearBus connector forwards these messages to the Arduino Ethernet board (through Internet) who Turns On and Turns Off a power switch allowing in this way to control the light sequence form any place with a simple browser.<br />
<br />
'''Note:''' It is important to remark that Twitter in contrast to its traditional use (as message platform) in this case is used as a "text transport channel" to carry the pseudo RESTful string (like to the http protocol).<br />
<br />
<br />
<br />
----<br />
<br />
===Required Components===<br />
<br /><br />
To implement this App Note you will need:<br />
<br />
- 1 Arduino Ethernet Board<br />
<br />
- 1 Power Relay (5Vdc coil - 110/220Vac 5Amp power side)<br />
<br />
- 1 transistor BC548C (or equivalent)<br />
<br />
- 1 Diode 1N4148 (or equivalent)<br />
<br />
- 1 Resistor ( 2 KOhm 1/4 W)<br />
<br />
- 1 Ethernet Internet connection (with a RJ45 cable)<br />
<br />
- Difficulty Level: Low-Medium <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 1 - Setup a New NearBus Account===<br />
<br /><br />
<br />
To setup a new account in the NearBus Connector, please follow the steps 1 to 6 in the '''Hello World example''' [http://www.nearbus.net/hello_world.html]. The Step 6 allows you to test the system without connecting the power circuit :) <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 2 - Activate the Twitter Channel in NearBus===<br />
<br /><br />
To activate the Twitter Channel in your NearBus session, you should configure the parameters showed bellow.<br />
<br />
To access this configuration table select the TWITTER_CONFIG option in the drop down menu (on the DEVICE CONFIG screen).<br />
<br />
<br />
[[File:Presence_sim_2.png]]<br />
<br />
<br />
'''IMPORTANT:''' It is strongly recommended to define a "New Protected" Twitter account to use it as a communication channel between the IFTTT application and the NearBus Connector. If you do not define this account as "Protected" everybody will be able to follow it and therefore gain access to your NearBus user and password.<br />
<br />
'''Twitter Nikname:''' Your account name in Twitter.<br />
<br />
'''Channel Enable:''' Check this option to activate the Tweets reception.<br />
<br />
'''Subscribe:''' Check this option and the NearBus connector will send a follower request to your Twitter account (you should accept this request in you Twitter account as showed in the next step). <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 3 - Accept the NearBus Twitter Request===<br />
<br /><br />
<br />
Accept the request message sent by NearBus in your Twitter account as shown in the following picture. <br />
<br />
<br />
[[File:Presence_sim_3.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 4 - Create a New IFTTT task===<br />
<br /><br />
<br />
'''Note:''' For this step you should have your own IFTTT account.<br />
<br />
The following example shows how to create a cyclic 1 hour sequence (4 steps ON-OFF-ON-OFF of 15 min each): <br />
<br />
<br />
<br />
[[File:Presence_sim_4.png]]<br />
<br />
<br />
<br />
Ofcourse you can define your specific sequence configuring the "Date & Time" IFTTT trigger in another way.<br />
<br />
<br />
As IFTTT "Action Channel" you should use the Twitter option and configure it with the following RESTful command sequence:<br />
<br />
<pre><br />
Turn ON the light<br />
?user=****&pass=****&device=NB100xxx&channel=0&value=1&service=DIG_OUTPUT&reqid=xxx&{{CheckTime}}<br />
<br />
<br />
Turn OFF the ligth<br />
?user=****&pass=****&device=NB100xxx&channel=0&value=0&service=DIG_OUTPUT&reqid=xxx&{{CheckTime}}<br />
<br />
</pre><br />
<br />
<br />
Parameters<br />
<br />
'''user:''' Your NearBus user (it is what you use to login into the NearBus platform)<br />
<br />
'''pass:''' Your NearBus password (it is what you use to login into the NearBus platform)<br />
<br />
'''NB100xxx:''' The device ID (NearBus ID) that you are using for this example<br />
<br />
'''reqid:''' This "sequence number" should be different for each IFTTT rule defined.<br />
<br />
<br />
'''Note:''' the <nowiki>{{CheckTime}}</nowiki> is a dummy parameter used to make all the messages different (because Twitter rejects duplicate messages to avoid spam :) <br />
<br />
<br />
[[File:Presence_sim_5.png]]<br />
<br />
<br />
'''Note:''' For more information about how RESTful web communications works please visit www.nearbus.net<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 5 - Check the Twitter Messages===<br />
<br /><br />
<br />
Once that you have configured and linked the IFTTT and Twitter account you should begin to receive the IFTTT messages in your Twitter account each 15 min (for this example)<br />
<br />
<br />
'''Note:''' Take into account that IFTTT processes the Triggers each 15 minutes so you will receive messages at this ratio. Although this ratio looks slow, take into account that it runs 24hx365d so the possible applications can be interesting. <br />
<br />
<br />
[[File:Presence_sim_6.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 6 - Connect the Power Circuit===<br />
<br /><br />
<br />
If the system is working as expected, you can replace the LED for the power switch in order to get a cool application.<br />
<br />
The following picture shows the basic circuit that allows you to control a 110/200VAC power light. This is a very simple and inexpensive to implement circuit. <br />
<br />
<br />
[[File:Presence_sim_7.png]]<br />
<br />
<br />
'''IMPORTANT:''' Take into account that this circuit works with hazardous voltages so be careful when implementing the power side of this circuit. Remember: check twice, run once :) <br />
<br />
<br />
----<br />
<br />
===Testing More Features===<br />
<br /><br />
<br />
If you want to try more features available in the functions drop-down menu please refer to the HELP section for a detailed description of the NearBIOS features.<br />
<br />
If you are interested in knowing more about this App Note please contact us at: info@nearbus.net</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1242_-_Google_Dashboard&diff=143App Note 1242 - Google Dashboard2018-03-29T21:12:16Z<p>Nearwiki: Created page with "This App Note describes how to implement a web temperature dashboard for Arduino Ethernet. It is intended to show you how the Memory-Map concept works in the practice and the..."</p>
<hr />
<div>This App Note describes how to implement a web temperature dashboard for Arduino Ethernet. It is intended to show you how the Memory-Map concept works in the practice and the way in which it can help you to improve your Arduino projects with some few simple modifications.<br />
<br />
<br />
===Overview===<br />
<br /><br />
The system shown consists of an Arduino with a temperature sensor (eg. a LM134 lineal temperature sensor IC) connected to the NearBus Connector through internet to display the temperature value in a graphical way using the Google Spreadsheet Web App (as shown below). <br />
<br />
<br />
[[File:graphic_dash_0a.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===How does it work?===<br />
<br /><br />
<br />
As detailed in the overview section the NearBus system has two working modes, the VMCU (virtual microcontroller unit) mode and the TRNSP (transparent) mode. In this example we are going to use the TRNSP mode.<br />
<br />
Under the TRNSP mode the NearBus system works replicating two groups of 8 registers each (Reg_A and Reg_B) in a periodic way :<br />
<br />
'''Reg_A:''' Data sent from Microcontroller to the Cloud.<br />
<br />
'''Reg_B:''' Data received in the Microcontroller from the Cloud.<br />
<br />
<br />
In others words, the TRNSP mode can be understood as a RPC (Remote Procedure Call) or function call, that you make in your Arduino code to execute it in the cloud (as a spreadsheet formula or script), obtaining a result, and then using it in your Arduino code.<br />
<br />
The most powerful feature of NearBus is the extremely easy way in which this complex process can be achieved. Including a single line in your code (a function call) you will be able to synchronize the register blocks (8+8) with the Google Cloud and then access them from a simple spreadsheet table (2 rows 8 cells).<br />
<br />
So, under the TRNSP mode, changing a value in the spreadsheet replicates this value in the Arduino's memory (and vice versa) in a periodic way.<br />
<br />
<br />
[[File:Graphic_dash_0b.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 1 - Setup a New NearBus Account===<br />
<br /><br />
<br />
To setup a new account in the NearBus Connector, please follow the steps 1 to 5 in the Hello World [http://nearbus.net/hello_world.html] example.<br />
<br />
'''IMPORTANT:''' Remember that this example works in TRNSP mode so you should uncheck the VMCU option when configuring a new device (Step 2) in the NEW DEVICE configuration screen (VMCU is the default option).<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 2 - Setup the Google Channel in NearBus===<br />
<br /><br />
<br />
To activate the Google Channel in your NearBus session, you should configure the parameters shown below. To access this configuration table select the GOOGLE CONFIG option in the drop down menu (on the DEVICE CONFIG screen).<br />
<br />
'''NOTE:''' Take into account that for this step you will need a Google account. We recommend defining a new Google account for this environment if you already have one.<br />
<br />
<br />
[[File:Graphic_dash_2.png]]<br />
<br />
<br />
<br />
'''Google User:''' Your Google user name.<br />
<br />
'''Google Password:''' Your Google user password.<br />
<br />
'''Spreadsheet Key:''' Copy the Spreadsheet_ID and paste it into this field (*).<br />
<br />
'''Worksheet Order:''' For this first example should be FIRST<br />
<br />
'''Connector Status:''' Allows you to Turn On or Turn Off the connector. Set it to Running.<br />
<br />
<br />
(*) The following step will show you how to get this ID from Google.<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 3 - Configuring the Google Spreadsheet===<br />
<br /><br />
<br />
Login your Google account, select the Google Drive option in the menu bar and create a new spreadsheet.<br />
<br />
Create the Memory-Map table, this table should be defined between the cells A1 to I3 (3 rows of 9 columns) and should match exactly as the following format (of course you can change the colors :)<br />
<br />
<br />
[[File:Graphic_dash_3a.png]]<br />
<br />
<br />
The spreadsheet is identified by the Google Apps through a Spreadsheet_ID code, a long alphanumeric string (Base64 encoded) that follows to the keyword "key=" in the browser's address bar. You should identify it and copy and paste (be careful to include all characters). The following picture shows where this ID is located<br />
<br />
<br />
[[File:Graphic_dash_3b.png]]<br />
<br />
<br />
<br />
<br />
'''IMPORTANT:''' The different worksheets in a spreadsheet are identified by the physical order (from left to right) so you should be careful matching the worksheet order with the configuration chosen in the field WORKSHEET ORDER (in the GOOGLE CONNECTOR screen).<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 4 - Write the code into your Arduino===<br />
<br /><br />
<br />
For this example we use a simple analogRead() as shown below:<br />
<br />
'''A_register[0] = analogRead(0);'''<br />
<br />
<br />
Additionally you should include the NearBus service call (in some point of the main loop() function :<br />
<br />
'''Agent.NearChannel( A_register, B_register, &ret );'''<br />
<br />
<br />
[[File:Graphic_dash_4.png]]<br />
<br />
<br />
'''NOTE:''' Remember that NearBus offers you 2 groups of 8 registers each that are synchronized in each exchange operation and you can use them freely in your code.<br />
<br />
<br />
<table border="1" cellspacing="0"><br />
<tr align="center"><th width="150"><b>GROUP_ A</b></th><th width="150"><b>GROUP_ B</b></th></tr><br />
<tr align="center"><td>A_register[0]</td><td>B_register[0] </td></tr><br />
<tr align="center"><td>A_register[1]</td><td>B_register[1] </td></tr><br />
<tr align="center"><td>A_register[2]</td><td>B_register[2] </td></tr><br />
<tr align="center"><td>A_register[3]</td><td>B_register[3] </td></tr><br />
<tr align="center"><td>A_register[4]</td><td>B_register[4] </td></tr><br />
<tr align="center"><td>A_register[5]</td><td>B_register[5] </td></tr><br />
<tr align="center"><td>A_register[6]</td><td>B_register[6] </td></tr><br />
<tr align="center"><td>A_register[7]</td><td>B_register[7] </td></tr><br />
</table><br />
<br />
<br />
<br />
----<br />
<br />
===STEP 5 - Define the math formulas in the Worksheet===<br />
<br /><br />
<br />
Create the dashboard using the different gadgets that Google offers to you (Gauges, Charts, etc, form more detail see insert-> gadgets in the spreadsheet menu bar).<br />
<br />
The Memory-Maps table works as a simple spreadsheet table with the following characteristics:<br />
<br />
Each "x" seconds the NearBus will update the Reg_A with the values sent by the remote Agent (eg. Arduino) and then will read the value stored in the Reg_B (and return them to the remote Agent). As we mentioned before the system works as a typical function call from the Arduino code point of view. <br />
<br />
<br />
[[File:Graphic_dash_5.png]]<br />
<br />
<br />
'''NOTE:''' Because Google's Cloud Infrastructure impose some limitations in the service quota in order to avoid system overload, the synchronization period is limited to 10 seconds.<br />
<br />
'''NOTE:''' In order to avoid upgrade the REG_B in the NearBus Data Base you should fill all the REG_B cells (from B3 to I3) to null (case sensitive). This feature will allow you to avoid data collision when using the Google Connector and REST API simultaneously. <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 6 - Wire your Arduino===<br />
<br /><br />
<br />
In this example we replace the temperature sensor (an LM134) for a simple rheostat connected to the A0 pin in order to test the system. The following picture shows the trivial configuration required in order to emulate the temperature sensor (the rheostat can be of any value between 10K and 100K ohm).<br />
<br />
<br />
[[File:Graphic_dash_6.png]]<br />
<br />
<br />
----<br />
<br />
<br />
<br />
If you want to try more features available in the functions drop-down menu please refer to the '''HELP''' [http://www.nearbus.net/v1/help_aux.html] section for a detailed description.<br />
<br />
If you are interested in knowing more about this App Note please contact us at: '''info@nearbus.net'''</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Video_Gallery&diff=142Video Gallery2018-03-29T21:11:41Z<p>Nearwiki: Created page with "<br /> ===Servo Controller=== <br /> <html><iframe width="480" height="360" src="//www.youtube.com/embed/LUamQZeaIik?rel=0" frameborder="0" allowfullscreen></iframe></html> <b..."</p>
<hr />
<div><br /><br />
===Servo Controller===<br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/LUamQZeaIik?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
----<br />
===Power Meter (Pulse Counter)===<br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/4i-i08QY7Lo?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
----<br />
===Power Switch with Feedback Signal===<br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/nJg9kCV3m3I?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
----<br />
===Current Meter (Current Transformer)===<br />
<br /><br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/QcBm-nSuebw?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br /><br />
<br /><br />
<br /><br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1252_-_Xively_Temperature_Controller&diff=141App Note 1252 - Xively Temperature Controller2018-03-29T21:11:12Z<p>Nearwiki: Created page with "This App Note introduces an experimental way to control the room temperature in a more efficient way. ===Overview=== <br /> This App Note is intended to show how to impleme..."</p>
<hr />
<div>This App Note introduces an experimental way to control the room temperature in a more efficient way.<br />
<br />
<br />
<br />
===Overview===<br />
<br /><br />
This App Note is intended to show how to implement a simple Temperature Control System using the X-Controller NearBus feature. The system works under the NearBus paradigm, this means that every sensed signal will be transmitted to the Cloud for its processing. No processing is accomplished in the remote device that works in a transparent way, controlling the sensors and actuators through the NearBios functions<br />
<br />
The following picture shows an implementation of a simple controller (using only one temperature sensor) using two Arduino boards. <br />
<br />
<br />
[[File:x_temp_control_0.png]]<br />
<br />
<br />
<br />
'''Note:''' It is important to remark that under the NearBus architecture it is possible to implement this solution using another microcontroller platform in a transparent way (for example a Wi-Fi board in order to simplify the system deployment thanks to the Wi-Fi connectivity).<br />
<br />
<br />
----<br />
<br />
===How does it work?===<br />
<br /><br />
<br />
The system shown works as a traditional digital controller. The temperature sensor is sampled each 2000 ms for example (a configurable value) and feed it to a proportional controller (with hysteresis to avoid a flapping output). The controller compare the sensed signal with its internal setting and decides to turn on or off the electrical heater in order to maintain the room's temperature as near as possible to the configured value.<br />
<br />
In this example we used two Arduino boards (one for the temperature sensor an another for the power relay) in order to show you the way in which the NearBus system works (of course it can be implemented using only one Arduino board).<br />
<br />
<br />
'''Close Control Loop'''<br />
<br />
As a traditional control system this example works as a close control loop. The temperature is sensed at sampling time (eg. each 2000 ms) and then compared against the setting reference value (eg. 22 deg. C ). This resulting signal is used to control the power relay output. As usual in this type of ON/OFF controllers, a Deadban (hysteresis) module is mandatory in order to avoid a flapping output (eg. 1 deg. C).<br />
<br />
<br />
<br />
'''System Components'''<br />
<br /><br />
The system is composed by three main components:<br />
<br />
*'''The power switch:''' Arduino Ethernet/WiFi board + Relay driver<br />
<br />
*'''The temperature sensor:''' Arduino Ethernet/WiFi + temperature sensor ( LM35 lineal IC)<br />
<br />
*'''The NearBus X-Controller:''' An special NearBus feature that allows to interconnect remote devices using the Xively Cloud Infraestructure<br />
<br />
<br />
----<br />
<br />
===X-CONTROL Configuration===<br />
<br />
<br />
====TEMPERATURE SENSOR CONFIGURATION (INPUT)====<br />
<br /><br />
The following picture shows the X-CONTROL configuration for the temperature sensor device (Arduino Ethernet/WiFi). In this example we use a LM35 lineal Sensor [[http://www.nearbus.net/downloads/datasheets/LM35.pdf]] as temperature sensor (that offer an output of 10mV/ºC).<br />
<br />
<br />
[[File:x_temp_control_1.png]]<br />
<br />
<br />
*'''Function:''' It shows the "DEVICE CONFIGURATION" screen configured function: ADC_INPUT (this option should be configured in the DEVICE CONFIGURATION screen for the specified device)<br />
<br />
<br />
<br />
*'''Manual:''' It shows the "DEVICE CONFIGURATION" screen configured mode: MANUAL (this option should be configured in the DEVICE CONFIGURATION screen for the specified device)<br />
<br />
<br />
*'''--> : ''' This option configure the channel in "Device TO Xlively" mode (the sensed value will be sent to Xlively)<br />
<br />
<br />
*'''Gain:''' A value of 0.323 is used (in this example) to adapt the read value to a Celsius value:<br />
<br />
'''Gain Calculation Example'''<br />
- ADC 10 bits (1023 steps)<br />
- ADC Vref = 3300mV (3.3Vdc)<br />
- Sensor LM35 10mV/ºC [[http://www.nearbus.net/downloads/datasheets/LM35.pdf]]<br />
<br />
'''Gain''' = 3300mV / 1023 / 10mV/ºC = '''0.323 ºC/step'''<br />
<br />
<br />
*'''Offset:''' 0 (It doesn't apply)<br />
<br />
<br />
*'''DeadBand:''' NO (this feature doesn't apply)<br />
<br />
<br />
*'''Filter:''' Selected (in order to smooth the read signal)<br />
<br />
<br />
*'''Stream ID:''' The Xively Stream ID (where the signal will be shareD with other NearBus device)signal)<br />
<br />
<br />
<br />
----<br />
<br />
====POWER RELAY CONFIGURATION (OUTPUT)====<br />
<br /><br />
The following picture shows the X-CONTROL configuration for the Power Relay Control device (Arduino Ethernet/Wi-Fi). <br />
<br />
<br />
[[File:x_temp_control_2.png]]<br />
<br />
<br />
*'''Function:''' It shows the "DEVICE CONFIGURATION" screen configured function: DIG_OUTPUT (this option should be configured in the DEVICE CONFIGURATION screen for the specified device)<br />
<br />
<br />
*'''Manual:''' It shows the "DEVICE CONFIGURATION" screen configured mode: MANUAL (this option should be configured in the DEVICE CONFIGURATION screen for the specified device)<br />
<br />
<br />
*'''<-- : ''' This option configure the channel in "Xlively TO Device" mode (the processed value will be sent to the Device)<br />
<br />
<br />
*'''Gain:''' 1 (there is no gain required in the stage)<br />
<br />
<br />
*'''Offset:''' The Temperature set-point should be configured here (as negative value) in order to shape the signal before it be precessed by the Deadband function.<br />
<br />
<br />
*'''DeadBand:''' The DeadBand value (1/2 of it) should be configured here. A negative value indicate that the output will be DOWN when the signal is raising, and it will be UP when the signal is decreasing (making stable the control system)<br />
<br />
<br />
The following example explain how this function works: When the sensed signal drops below the bottom setting value in the Deadband function (below 21,5 deg. C) , the output will be UP (turning ON the heater). In turn when the temperature rises over the top setting value in the hysteresis block ( over 22,5 deg. C) the output will go DOWN (turning OFF the heater).<br />
<br />
<br />
[[File:Hysteresis_window.png]]<br />
<br />
<br />
<br />
*'''Filter:''' NOT SELECTED (this feature doesn't apply)<br />
<br />
<br />
*'''Stream ID:''' The Xively Stream ID (where the signal will be read)<br />
<br />
<br />
----<br />
<br />
====XIVELY CHART EXAMPLE====<br />
<br />
The following picture shows a real example on the Xively chart temperature register for a system working under a temperature set point of 18.5 ºC<br />
<br />
<br />
[[File:x_temp_control_3.png]]<br />
<br />
<br /><br />
----<br />
<br /></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1227_-_Room_Temperature_Controller&diff=140App Note 1227 - Room Temperature Controller2018-03-29T21:10:35Z<p>Nearwiki: Created page with "This App Note introduces an experimental way to control the room temperature in a more efficient way. ===Overview=== <br /> In contrast with the traditional system where th..."</p>
<hr />
<div>This App Note introduces an experimental way to control the room temperature in a more efficient way.<br />
<br />
<br />
<br />
===Overview===<br />
<br /><br />
In contrast with the traditional system where the temperature is controlled by a local device, this system works under the NearBus paradigm, this means that every sensed signal will be transmitted to the Cloud for its processing. No processing is accomplished in the remote device that works in a transparent way, controlling the sensors and actuators through the NearBios functions<br />
<br />
The following picture shows an implementation of a simple controller (using only one temperature sensor) using two Arduino Ethernet boards. <br />
<br />
<br />
[[File:Temperature_controller.png]]<br />
<br />
<br />
<br />
'''Note:''' It is important to remark that under the NearBus architecture it is possible to implement this solution using another microcontroller platform in a transparent way (for example a Wi-Fi board from OpenPicus in order to simplify the system deployment thanks to the Wi-Fi connectivity).<br />
<br />
<br />
----<br />
<br />
===How does it work?===<br />
<br /><br />
<br />
The system shown works as a traditional digital controller. The temperature sensor is sampled each 2000 ms for example (a configurable value) and feed it to a proportional controller (with hysteresis to avoid a flapping output). The controller compare the sensed signal with its internal setting and decides to turn on or off the electrical heater in order to maintain the room's temperature as near as possible to the configured value.<br />
<br />
In this example we used two Arduino Ethernet boards (one for the temperature sensor an another for the power relay) in order to show you the way in which the NearBus system works (of course it can be implemented using only one Arduino Ethernet board).<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===Close Control Loop===<br />
<br /><br />
As a traditional control system this example works as a close control loop. The temperature is sensed at sampling time (eg. each 2000 ms) and then compared against the setting reference value (eg. 22 deg. C ). This resulting signal is used to control the power relay output. As usual in this type of ON/OFF controllers, a hysteresis module is mandatory in order to avoid a flapping output (eg. 1 deg. C).<br />
<br />
When the sensed signal drops below the bottom setting value in the hysteresis block (below 21,5 deg. C) , the output will be UP (turning ON the heater). In turn when the temperature rises over the top setting value in the hysteresis block ( over 22,5 deg. C) the output will go DOWN (turning OFF the heater).<br />
<br />
<br />
[[File:Hysteresis_window.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===System components===<br />
<br /><br />
The system is composed by three main components:<br />
<br />
*'''The power switch:''' Arduino Ethernet board + Relay driver<br />
<br />
*'''The temperature sensor:''' Arduino Ethernet + temperature sensor ( LM35 lineal IC)<br />
<br />
*'''The controller:''' a software code written in PHP and running over an Internet Apache Web Server.<br />
<br />
The controller code basically consist of a simple state machine implemented into the PHP code working as a callback function. This function will be called each time that the remote temperature sensor updates a new value in the NearBus system.<br />
<br />
<br />
<br />
----<br />
<br />
===System Benefits===<br />
<br /><br />
Although at first this temperature controller system looks like a Rube Goldberg machine [http://en.wikipedia.org/wiki/Rube_Goldberg], the NearBus system offers some improvements when it is configured in a more complex way:<br />
<br />
<br />
'''- PIR Detector:''' One of the main features of a NearBus architecture is that it allows to integrate additional sensors and actuators in an easy way. Adding a PIR sensor for example will enable the system to turn off (or reduce the setting temperature) when there are no people in the room.<br />
<br />
'''- Spot Temperature Control:''' Another interesting feature is the ability to deploy multiple Wi-Fi temperature sensors and Wi-Fi heater switches, allowing to define different spot zones and control them in a more energy-efficient way.<br />
<br />
<br />
<br />
If you are interested in knowing more about this App Note please contact us at: '''info@nearbus.net'''<br />
<br />
<br />
<br />
----<br />
<br />
===System Implementation===<br />
<br /><br />
This JavaScript code (running from a browser) will allows you to implement a simple control loop to maintain the room temperature at the set point.<br />
<br /><br />
<br /><br />
'''Required Componets'''<br />
<br /><br />
In order to implement this example under an Arduino + Grove platform you can use the following components:<br />
<br />
* Temperature Sensor: [[One-Wire Temperature Sensor - DS18B20]]<br />
<br />
* Power Relay: [[Grove Power Relay]]<br />
<br />
* Arduino Grove Shield: [[Arduino Grove Shield]]<br />
<br />
<br />
----<br />
<br />
===JavaScript Code===<br />
<br /><br />
<br />
'''Note:''' In order to run this code you should copy the following code into a file, save it with html extension and run it in your browser. Additionally you should replace the device_ID, user and password in this file.<br />
<br />
<br />
<pre><br />
<!DOCTYPE html><br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net * --> <br />
<!-- * Description: This example shows how to implement a closed loop temperature controller in JavaSript * --> <br />
<!-- * This code is intended to run on a browser to control a room temperature in a experimental way. * --> <br />
<!-- * The system is configured to work with a LM35 (lineal Temp Sensor (ºC) * --> <br />
<!-- * Support: info@nearbus.net * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * REVISION HISTORY * --><br />
<!-- * v0.1 - 09-08-13 - Initial Release * --> <br />
<!-- * v0.2 - 24-10-13 - Upgrade to support nearapi_v05.js * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<br />
<script><br />
// +------------------------------------------------------------------------------+<br />
// | WARNING |<br />
// | Be careful to avoid run more than one scripts simultaneously !!! |<br />
// | Don't forget CLOSE the running script before start a new or modified script. |<br />
// | The NearBus system can run multiple scripts but the system output will be |<br />
// | the mix of all running sessions. | <br />
// +------------------------------------------------------------------------------+ <br />
<br />
// +--------------------------------------------------------------------+<br />
// | To run this example you should replace the following parameters |<br />
// | device_id Your device ID, or.. devices ID :) |<br />
// | user Your NearBus Web user |<br />
// | pass Your NearBus Web password |<br />
// +--------------------------------------------------------------------+<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var switch_device_id = "NB100xxx";<br />
var temp_device_id = "NB100xxx";<br />
<br />
var user = "***"; // Your NearBus Web user<br />
var pass = "***"; // Your NearBus Web password<br />
<br />
var LOOP_DELAY = 2000; // Main Loop Delay in ms<br />
var WATCH_DOG = 51; // Watch Dog TTL<br />
<br />
//////////////////////////////////<br />
// Persistent Variables<br />
//////////////////////////////////<br />
var step_pointer = 5;<br />
var reset_system;<br />
var enable_system;<br />
var ret = 0;<br />
var my_watch_dog = WATCH_DOG;<br />
var state_log = "Waiting";<br />
var heater = 0;<br />
var error_flag = "";<br />
<br />
var temp_reference = 22.5;<br />
<br />
var temperature = 0;<br />
<br />
///////////////////////////////////<br />
// Function: sysStop()<br />
/////////////////////////////////// <br />
function sysStop() {<br />
reset_system = 1;<br />
enable_system = 0;<br />
}<br />
<br />
///////////////////////////////////<br />
// Function: sysStart()<br />
/////////////////////////////////// <br />
function sysStart() {<br />
enable_system = 1;<br />
reset_system = 0;<br />
}<br />
<br />
///////////////////////////////////<br />
// Function: refreshDisplay()<br />
/////////////////////////////////// <br />
function refreshDisplay() {<br />
<br />
$('#field_1').text( "STEP = " + step_pointer.toString() ); <br />
$('#field_2').text( "STATE = " + state_log + error_flag );<br />
$('#field_3').text( "NearAPI Ret = " + state_log_api );<br />
$('#field_4').text( "Watch_Dog = " + my_watch_dog.toString() );<br />
$('#field_5').text( "Heater = " + heater );<br />
$('#field_6').text( "Room Temp = " + temperature ); <br />
}<br />
<br />
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// Function: Main<br />
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <br />
$(document).ready( function ()<br />
{<br />
<br />
state_log = "Starting...";<br />
<br />
setInterval( function()<br />
{ <br />
<br />
//**************************************************<br />
// WATCH DOG CONTROL<br />
//**************************************************<br />
my_watch_dog--;<br />
if ( my_watch_dog <= 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
//**************************************************<br />
// ERROR CHECK<br />
//**************************************************<br />
if ( ret == "ERROR" ) {<br />
error_flag = " - SYSTEM ERROR";<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
//**************************************************<br />
// DEVICE DOWN<br />
//**************************************************<br />
if ( ret == "DOWN" ) {<br />
error_flag = " - SYSTEM DOWN";<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// STATE MACHINE<br />
/////////////////////////////////////////////////////////////////////<br />
if( reset_system == 1 ) {<br />
reset_system = 0;<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
refreshDisplay();<br />
<br />
switch ( step_pointer )<br />
{<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 5] - SYSTEM RESET - TURN OFF HEATER<br />
/////////////////////////////////////////////////////////////////////<br />
case 5:<br />
state_log = "Resetting System... ( please wait )";<br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "DIG_OUTPUT", switch_device_id, 0, 0 );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 10; <br />
}<br />
break <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 10] - SYSTEM OFF<br />
/////////////////////////////////////////////////////////////////////<br />
case 10:<br />
state_log = "System READY";<br />
refreshDisplay();<br />
<br />
heater = "OFF"; <br />
my_watch_dog = WATCH_DOG;<br />
<br />
if( enable_system == 1 ) { <br />
enable_system = 0;<br />
error_flag = "";<br />
step_pointer = 20;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 20] - SENSING TEMPERATURE<br />
///////////////////////////////////////////////////////////////////// <br />
case 20:<br />
state_log = "Sensing Temperature..."; <br />
refreshDisplay(); <br />
ret = NearAPIjs( "ADC_INPUT", temp_device_id , 0, 0 );<br />
if( ret != "WAIT" ) {<br />
my_watch_dog = WATCH_DOG;<br />
<br />
temp_reference = parseFloat( document.getElementById("f_temperature").value );<br />
<br />
temperature = (ret * 2) / 10; // LM35 10mV/ºC<br />
if( temperature > ( temp_reference + 0.5) ) {<br />
heater = 0;<br />
}<br />
else if ( temperature < (temp_reference - 0.5) ) {<br />
heater = 1;<br />
}<br />
step_pointer = 30;<br />
}<br />
break;<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 30] - TURN OFF HEATER <br />
/////////////////////////////////////////////////////////////////////<br />
case 30:<br />
state_log = "Controlling Heater"; <br />
refreshDisplay();<br />
ret = NearAPIjs( "DIG_OUTPUT", switch_device_id , 0, heater ); <br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
service_run = "NO";<br />
step_pointer = 20;<br />
}<br />
break; <br />
} <br />
<br />
}, LOOP_DELAY ); <br />
} );<br />
<br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * HTML CODE * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
<p><b> NEARBUS - ROOM TEMP. CONTROLLER </b></p><br />
<br />
<div id="field_1">Field_1</div><br />
<br /><br />
<div id="field_2">Field_2</div><br />
<br /><br />
<div id="field_3">Field_3</div><br />
<br /><br />
<div id="field_4">Field_4</div><br />
<br /><br />
<div id="field_5">Field_5</div><br />
<br /><br />
<div id="field_6">Field_6</div><br />
<br /><br />
<select id="f_temperature"><br />
<option> 22.0 </option><br />
<option selected> 22.5 </option><br />
<option> 23.0 </option><br />
<option> 23.5 </option><br />
<option> 24.0 </option><br />
<option> 24.5 </option><br />
<option> 25.0 </option><br />
<option> 25.5 </option><br />
<option> 26.0 </option><br />
<option> 27.0 </option><br />
<option> 28.0 </option><br />
<option> 29.0 </option><br />
</select><br />
<br /><br />
<br /><br />
<button onclick="sysStart()">START</button><br />
<br /><br />
<br /><br />
<button onclick="sysStop()">STOP</button><br />
<br />
</body><br />
</html><br />
</pre><br />
<br />
----<br />
<br /></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=JavaScript_Coffee_Maker&diff=139JavaScript Coffee Maker2018-03-29T21:10:02Z<p>Nearwiki: Created page with " ===Overview=== <br /> This JavaScript example is intended to show you how to implement a real application using the NearBus system. The example is based in coffee machine sys..."</p>
<hr />
<div><br />
===Overview===<br />
<br /><br />
This JavaScript example is intended to show you how to implement a real application using the NearBus system. The example is based in coffee machine system which has a good level of complexity to understand how the NearBus system works. (edit the .html file to see the code explanation). The example shows how control different devices (motors, sensors, etc.) using the NearBus RESTful API.<br />
<br />
<br />
<br />
<br />
[[File:i_coffee_1.png]]<br />
<br />
<br />
<br />
<br />
The following picture details how each element can be controlled through a simple URL, simplifying the HW integration in any SW deployment platform (JavaScript, Java, PHP, etc.)<br />
<br />
<br />
[[File:i_coffee_2.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===JavaScript Code===<br />
<br /><br />
<br />
'''Note:''' In order to run this example you should download and run the CoffeMaker_1v0.html javascript file inside the folder.<br />
<br />
'''Donwload:''' http://www.nearbus.net/downloads/js_apps/CoffeMaker_1v0.rar<br />
<br />
<br />
<br />
'''PROGRAM DESCRIPTION'''<br />
<br />
This JavaScript example is intended to show you how to implement a real application using the NearBus system. The example is based in coffee machine system which has a good level of complexity to understand how the NearBus system works. The system works as a finite state machine that implement the sequence required to accomplish the coffee maker process.<br />
<br />
<br />
The selected coffee machine has the following components:<br />
<br />
* A motorized Valve (to isolate the coffee grains compartment). <br />
<br />
* A Grinder Motor (to grind the coffee grains).<br />
<br />
* An Electric Heater to boil the water in order to make the coffee.<br />
<br />
<br />
There are some others sensors like Thermal switchs and Temperature sensors that are not included in this example in order to simplify the explanation.<br />
<br />
'''This example uses the following NearBus API service:'''<br />
<br />
'''NearAPI:''' nearbus.net/v1/api_vmcu_jsb<br />
<br />
<br />
This implementation only works with the NearAgent version v06 (or greater). <br />
<br />
<br />
'''API Characteristics:'''<br />
<br />
* This API service returns immediately (with the actual value in the NearBus Data Base).<br />
<br />
<br />
* The API needs a “request_id” in order to match the request with the response. If the "request_id" does not match with the "request_id" in the NearBus Data Base, the API return "NULL" (this means that you always will need make two requests in order to obtain a valid value (no NULL). This "twin-call" procedure allows to the API call returns immediately simplifying the way in which the system can be programmed under JavaScript.<br />
<br />
<br />
* The main NearBIOS Service used in this example is the PULSE_OUTPUT. This service allows you to generate a pulse of x [ms] (in steps of 10ms).<br />
<br />
<br />
* This feature allows turn on a remote power device in a secure way through Internet, because you will be sure that the remote powered device will be shut down even if the internet connection with the remote Agent is lost.<br />
<br />
<br />
* The following REST call can be used to test the system in a manual way:<br />
<br />
http:nearbus.net/v1/api_vmcu_jsb/NB100***?user=***&pass=***&channel=0&service=PULSE_OUTPUT&value=500&method=POST&reqid=12345<br />
<br />
<br />
<br />
* There are another additional security features like the "Watch Dog" counter. This feature “supervise the critical sections in the state machine and resets the system if it go into a infinite (or very long) loop.<br />
<br />
<br />
You can try this example with an Arduino Ethernet or Wi-Fi board checking the sequence over the pins 3-5-6-and 9 (arduino Uno Board) <br />
<br />
<br />
<br />
<br />
<br />
<pre><br />
<br />
<!DOCTYPE html><br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v03.js'></script><br />
<br />
<br />
<script><br />
<br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// / | / /__ ____ ______/ /_ __ _______ //<br />
// / |/ / _ \/ __ `/ ___/ __ \/ / / / ___/ //<br />
// / /| / __/ /_/ / / / /_/ / /_/ (__ ) //<br />
// /_/ |_/\___/\__,_/_/ /_.___/\__,_/____/ //<br />
// www.nearbus.net - info@nearbus.net //<br />
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// REVISION HISTORY<br />
// v0.1 - 09-08-13 - Initial Release<br />
// v0.2 - 14-10-13 - Upgrade to support nearapi_v03.js<br />
//<br />
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
// +------------------------------------------------------------------------------+<br />
// | IMPORTANT |<br />
// | Be careful to avoid run more than one scripts simultaneously !!! |<br />
// | Don't forget CLOSE the running script before start a new or modified script. |<br />
// | The NearBus system can run multiple scripts but the system output will be |<br />
// | the mix of all running sessions. | <br />
// +------------------------------------------------------------------------------+ <br />
<br />
// +--------------------------------------------------------------------+<br />
// | To run this example you should replace the following parameters |<br />
// | device_id Your device ID, or.. devices ID :) |<br />
// | user Your NearBus Web user |<br />
// | pass Your NearBus Web password |<br />
// +--------------------------------------------------------------------+<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var device_id = "NB100***"; // Your device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
var intensity = "TEST"; // Coffee Intensity<br />
<br />
<br />
var LOOP_DELAY = 2000; // Main Loop Delay in ms<br />
var WATCH_DOG = 31; // Watch Dog TTL<br />
<br />
//////////////////////////////////<br />
// Defines<br />
//////////////////////////////////<br />
// ELEMENT PORT<br />
var THERMOSTAT = 1; // Bimetal Thermal Switch ( Heater sensor )<br />
var CLOSE_VALVE = 2; // Grinder Coffee Valve (Close)<br />
var OPEN_VALVE = 3; // Grinder Coffee Valve (Open)<br />
var MOTOR_ON = 4; // Grinder Motor<br />
var HEATER_ON = 5; // Water Heater<br />
<br />
//////////////////////////////////<br />
// Persistent Variables<br />
//////////////////////////////////<br />
var step_pointer = 5;<br />
var reset_system;<br />
var enable_system;<br />
var ret = 0;<br />
var my_watch_dog = WATCH_DOG;<br />
var state_log = "Waiting";<br />
var heater = "OFF";<br />
var aux_delay = 0;<br />
<br />
<br />
///////////////////////////////////<br />
// Function: sysStop()<br />
/////////////////////////////////// <br />
function sysStop() {<br />
reset_system = 1;<br />
enable_system = 0;<br />
}<br />
<br />
///////////////////////////////////<br />
// Function: sysStart()<br />
/////////////////////////////////// <br />
function sysStart() {<br />
enable_system = 1;<br />
reset_system = 0;<br />
}<br />
<br />
///////////////////////////////////<br />
// Function: refreshDisplay()<br />
/////////////////////////////////// <br />
function refreshDisplay() {<br />
<br />
$('#field_1').text( "STEP = " + step_pointer.toString() ); <br />
$('#field_2').text( "STATE = " + state_log );<br />
$('#field_3').text( "NearAPI Ret = " + ret );<br />
$('#field_4').text( "Watch_Dog = " + my_watch_dog.toString() );<br />
$('#field_5').text( "Heater = " + heater ); <br />
}<br />
<br />
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// Function: Main<br />
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <br />
$(document).ready( function ()<br />
{<br />
<br />
state_log = "Starting...";<br />
<br />
setInterval( function()<br />
{ <br />
<br />
//**************************************************<br />
// WATCH DOG CONTROL<br />
//**************************************************<br />
my_watch_dog--;<br />
if ( my_watch_dog <= 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 5;<br />
}<br />
<br />
//**************************************************<br />
// ERROR CHECK<br />
//**************************************************<br />
if ( ret == "ERROR" ) {<br />
step_pointer = 5;<br />
}<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// STATE MACHINE<br />
/////////////////////////////////////////////////////////////////////<br />
if( reset_system == 1 ) {<br />
reset_system = 0;<br />
step_pointer = 5;<br />
}<br />
<br />
refreshDisplay();<br />
<br />
switch ( step_pointer )<br />
{<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 5] - SYSTEM RESET<br />
/////////////////////////////////////////////////////////////////////<br />
case 5:<br />
state_log = "Resetting System... ( please wait )";<br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "DIG_OUTPUT", device_id, HEATER_ON, 0 ); <br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 6;<br />
} <br />
break;<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 6] - SYSTEM OFF<br />
/////////////////////////////////////////////////////////////////////<br />
case 6:<br />
state_log = "System READY";<br />
refreshDisplay();<br />
<br />
heater = "OFF"; <br />
my_watch_dog = WATCH_DOG;<br />
<br />
if( enable_system == 1 ) { <br />
enable_system = 0;<br />
step_pointer = 10;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 10] - RESETING VALVE (CLOSE)<br />
/////////////////////////////////////////////////////////////////////<br />
case 10:<br />
state_log = "Resetting_Valve"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "PULSE_OUTPUT", device_id, CLOSE_VALVE, 6000 );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 15;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 15] - RESETING VALVE (CLOSE) ACK<br />
/////////////////////////////////////////////////////////////////////<br />
case 15:<br />
state_log = "Waiting: Reset_Valve_ACK"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "GET_PULSE_OUTPUT", device_id, CLOSE_VALVE, 0 );<br />
if( ret == 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 20;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 20] - OPEN VALVE <br />
/////////////////////////////////////////////////////////////////////<br />
case 20:<br />
state_log = "Opening_Valve"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "PULSE_OUTPUT", device_id, OPEN_VALVE, 6000 );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 25;<br />
}<br />
break;<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 25] - OPEN VALVE ACK (1)<br />
/////////////////////////////////////////////////////////////////////<br />
case 25:<br />
state_log = "Waiting: Open_Valve_ACK"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "GET_PULSE_OUTPUT", device_id, OPEN_VALVE, 0 );<br />
if( ret == 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 30;<br />
}<br />
break;<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 30] - TURN ON GRINDING MOTOR<br />
///////////////////////////////////////////////////////////////////// <br />
case 30:<br />
state_log = "Grinder_Motor_ON";<br />
refreshDisplay(); <br />
<br />
if( intensity == "INTENSE" ) {<br />
aux_delay = 30000; // 35 sec<br />
}<br />
else if( intensity == "NORMAL" ) {<br />
aux_delay = 25000; // 25 sec <br />
}<br />
else if( intensity == "LIGHT" ) {<br />
aux_delay = 10000; // 20 sec<br />
} <br />
else if( intensity == "TEST" ) {<br />
aux_delay = 2000; // 2 sec to test the system<br />
} <br />
<br />
ret = NearAPIjs( "PULSE_OUTPUT", device_id, MOTOR_ON, aux_delay );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 35;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 35] - TURN ON GRINDING MOTOR ACK<br />
/////////////////////////////////////////////////////////////////////<br />
case 35:<br />
state_log = "Waiting: Grinder_Motor_ON_ACK"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "GET_PULSE_OUTPUT", device_id, OPEN_VALVE, 0 );<br />
if( ret == 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 40;<br />
}<br />
break;<br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 40] - CLOSE VALVE<br />
/////////////////////////////////////////////////////////////////////<br />
case 40:<br />
state_log = "Closing_Valve"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "PULSE_OUTPUT", device_id , CLOSE_VALVE, 6000 );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 45;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 45] - CLOSE VALVE ACK<br />
/////////////////////////////////////////////////////////////////////<br />
case 45:<br />
state_log = "Waiting: Close_Valve_ACK"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "GET_PULSE_OUTPUT", device_id , CLOSE_VALVE, 6000 );<br />
if( ret == 0 ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 50;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 50] - TURN ON HEATER<br />
///////////////////////////////////////////////////////////////////// <br />
case 50:<br />
state_log = "Turning On Heater..."; <br />
refreshDisplay(); <br />
<br />
ret = NearAPIjs( "DIG_OUTPUT", device_id , HEATER_ON, 1 );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 55;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 55] - TURN ON HEATER ACK<br />
///////////////////////////////////////////////////////////////////// <br />
case 55:<br />
state_log = "Waiting: Heater_ON_ACK"; <br />
refreshDisplay(); <br />
<br />
ret = NearAPIjs( "ADC_INPUT", device_id , THERMOSTAT, 0 );<br />
if( ret == "WAIT" ) {<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 55;<br />
}<br />
else if( ret < 128 )<br />
{<br />
heater = "ON"; <br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 60;<br />
}<br />
else if ( ret > 512 )<br />
{<br />
my_watch_dog = WATCH_DOG;<br />
step_pointer = 50; <br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 60] - WAIT FOR HEATER OFF<br />
///////////////////////////////////////////////////////////////////// <br />
case 60:<br />
state_log = "Making Coffee..."; <br />
refreshDisplay(); <br />
my_watch_dog = WATCH_DOG;<br />
ret = NearAPIjs( "ADC_INPUT", device_id , THERMOSTAT, 0 );<br />
if( ret > 512 ) {<br />
heater = "OFF"; <br />
my_watch_dog = WATCH_DOG;<br />
service_run = "NO";<br />
step_pointer = 70;<br />
}<br />
break; <br />
<br />
<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 70] - TURN OFF HEATER <br />
/////////////////////////////////////////////////////////////////////<br />
case 70:<br />
state_log = "Coffee_Done!!!"; <br />
refreshDisplay();<br />
<br />
ret = NearAPIjs( "DIG_OUTPUT", device_id , HEATER_ON, 0 );<br />
heater = "OFF"; <br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG;<br />
service_run = "NO";<br />
step_pointer = 5;<br />
}<br />
break; <br />
<br />
<br />
default:<br />
reset_system = 1;<br />
step_pointer = 5; <br />
<br />
break;<br />
} <br />
<br />
<br />
}, LOOP_DELAY ); <br />
} );<br />
<br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * HTML CODE * --><br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
<p><b> NEARBUS - COFFEE MAKER </b></p><br />
<br />
<div id="field_1">Field_1</div><br />
<br /><br />
<div id="field_2">Field_2</div><br />
<br /><br />
<div id="field_3">Field_3</div><br />
<br /><br />
<div id="field_4">Field_4</div><br />
<br /><br />
<div id="field_5">Field_5</div><br />
<br /><br />
<br /><br />
<button onclick="sysStart()">START</button><br />
<br /><br />
<br /><br />
<button onclick="sysStop()">STOP</button><br />
<br />
</body><br />
</html><br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Reliable_Power_Switch&diff=138Reliable Power Switch2018-03-29T21:00:58Z<p>Nearwiki: Created page with " The following code examples are intended to show you the simple way in which a NearBus enable device can be controlled from a simple Java Script code running on a browser (PC..."</p>
<hr />
<div><br />
The following code examples are intended to show you the simple way in which a NearBus enable device can be controlled from a simple Java Script code running on a browser (PC, or mobile device).<br />
<br />
<br />
Because the NearBus system has been designed to control power devices through internet in a reliable way, these examples explain the different configurations that you can implement in order to increase the reliability in your controlled system.<br />
<br />
<br />
<br />
=== Motor Switch Code - Basic Example ===<br />
<br /><br />
<br />
This simple example shows how to implement a basic Internet switch, to control a power load. The code implements the basic NearBus ACK call return in order to confirm that the remote agent has executed the command (at logical level) <br />
<br />
<br />
<br />
The following video shows a working implementation of this example<br />
<br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/LS5DCB91NTQ?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br /><br />
<br /><br />
<br />
In order to run this code you should copy the following code into a file, save it with html extension and run it in your browser. Additionally you should replace the device_ID, user and password in this file. <br />
<br />
<br />
===EXAMPLE CODE===<br />
<br />
<pre><br />
<!DOCTYPE html><br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v01.js'></script><br />
<script><br />
<br />
<br />
//***********************************************************************<br />
// USER CONFIGURATION<br />
//***********************************************************************<br />
var device_1 = "NB100***"; // Your device ID<br />
var user = "user"; // Your NearBus Web user<br />
var pass = "1234"; // Your NearBus Web password<br />
<br />
<br />
//***********************************************************************<br />
// SYSTEM CONFIGURATION<br />
//***********************************************************************<br />
var state_log = "Waiting";<br />
var motor_state = 0;<br />
var step_pointer = 10;<br />
var ret = 0;<br />
var LOOP_DELAY = 2000; // Main Loop Delay<br />
<br />
<br />
//***********************************************************************<br />
// Function: refreshDisplay()<br />
//*********************************************************************** <br />
function refreshDisplay()<br />
{<br />
$('#field_1').text( "Step_Pointer = " + step_pointer.toString() );<br />
$('#field_2').text( "Message = " + state_log ); <br />
$('#field_3').text( "Return = " + ret.toString() ); <br />
$('#field_4').text( "Motor = " + motor_state.toString() ); <br />
}<br />
<br />
<br />
//********************************<br />
// Function: MOTOR_ON<br />
//******************************** <br />
function Motor_On( )<br />
{<br />
step_pointer = 100;<br />
}<br />
<br />
//********************************<br />
// Function: MOTOR_OFF<br />
//******************************** <br />
function Motor_Off( )<br />
{ <br />
step_pointer = 200;<br />
}<br />
<br />
<br />
//********************************<br />
// Function: Main Loop<br />
//******************************** <br />
$(document).ready( function ()<br />
{<br />
<br />
setInterval( function()<br />
{<br />
switch ( step_pointer )<br />
{<br />
//*******************************<br />
// WAITING<br />
//*******************************<br />
case 10:<br />
break;<br />
<br />
<br />
//*******************************<br />
// MOTOR ON<br />
//******************************* <br />
case 100:<br />
ret = NearAPIjs( "DIG_OUTPUT", device_1, 0, 1 ); <br />
<br />
if( ret == 1 ) {<br />
motor_state = "ON";<br />
step_pointer = 10;<br />
}<br />
break;<br />
<br />
<br />
//*******************************<br />
// MOTOR OFF<br />
//******************************* <br />
case 200: <br />
ret = NearAPIjs( "DIG_OUTPUT", device_1, 0, 0 ); <br />
<br />
if( ret == 0 ) {<br />
motor_state = "OFF";<br />
step_pointer = 10;<br />
}<br />
break;<br />
<br />
}<br />
refreshDisplay();<br />
<br />
}, 1000 ); <br />
<br />
});<br />
<br />
<br />
</script><br />
</head><br />
<br />
<body><br />
<br />
<!-- *************************************************************************************** --> <br />
<!-- * HTML CODE * --> <br />
<!-- *************************************************************************************** --> <br />
<br />
<p><b> MOTOR SWITCH DEMO </b></p><br />
<br />
<div id="field_1">field_1</div><br />
<br /><br />
<div id="field_2">field_2</div><br />
<br /><br />
<div id="field_3">field_3</div><br />
<br /><br />
<div id="field_4">field_4</div><br />
<br /><br />
<br /><br />
<button onclick="Motor_On()">MOTOR ON</button><br />
<br /><br />
<br /><br />
<button onclick="Motor_Off()">MOTOR OFF</button><br />
</body><br />
<br />
</pre><br />
<br />
<br /><br />
<br /><br />
<br /><br />
----<br />
<br />
=== Motor Switch Code - Advanced Example ===<br />
<br /><br />
<br />
This example implements two features in order to increase the system reliability. In this context the reliability should be understood as an improvement in the capacity of all system to guarantee that the remote power switch works as expected, or under failure it will trip to a well-defined state. <br />
<br />
<br />
To accomplish this behaviour the system implements: <br />
* A Watch-Dog supervisor code. <br />
* A current feedback signal (using a non-invasive current transformer). <br />
<br />
<br />
The two systems work independently to guarantee the system whole reliability. The Watch-Dog code is a simple register counter that increments by one with each state-machine cycle. The Watch-Dog counter is reset with each successful operation and put the system in a "turn-off" state when the counter reaches a threshold level. <br />
<br />
<br />
The current transformer measures the real current that feeds the power load. This signal allows to the control system to know if the load is really working or not and then take the right action. The last versions of NearBus system offers enhanced features like the True RMS function that allows know the true RMS current value of the load. This feature allows calculate the active power that the load is consuming. <br />
<br />
<br />
<br />
'''Current Feedback'''<br />
<br />
To know if the Motor is running the system measured the current through the "RMS_INPUT" service. Before to measure the current, the system configures the remote ADC to a value of 1100mV calling the "RMS_INPUT_CONFIG" service (because this example uses a low power motor of only 15 Watts). The measured current is compared with a threshold reference of 10 in order to decide if the Motor is running or not. <br />
<br />
<br />
<br />
'''Power Calculation'''<br />
<br />
In order to calculate the active Power consumption we use the following parameters: <br />
<br />
* V = 220Vac<br />
* Power Factor = 0.75 (inductive motor)<br />
* TI Ratio = 5:2 [A/V]<br />
* Vref ADC 1100mV<br />
* ADC resolution 10 bits (1023)<br />
<br />
'''Power [Watts] = Irms * (1100 / 1023) / 1000 * (5 / 2) * 220 * 0.75'''<br />
<br />
<br />
<br />
The following picture shows the prototype used to test this example.<br />
<br />
[[File:Motor_switch_01.png|600px]] <br />
<br />
<br />
'''Components:'''<br />
<br />
*[[Grove Modules Guide#Grove - Electricity Sensor|Current Transformer]]<br />
<br />
*[[Grove Modules Guide#Grove - Relay|Power Relay]]<br />
<br />
*[[Arduino Grove Shield|Arduino Grove Shield]]<br />
<br />
<br /><br />
<br /><br />
===EXAMPLE CODE===<br />
<br />
<pre><br />
<!DOCTYPE html><br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v01.js'></script><br />
<br />
<script><br />
<br />
//***********************************************************************<br />
// USER CONFIGURATION<br />
//***********************************************************************<br />
var device_1 = "NB100***"; // Your device ID<br />
var user = "user"; // Your NearBus Web user<br />
var pass = "1234"; // Your NearBus Web password<br />
<br />
<br />
//***********************************************************************<br />
// SYSTEM CONFIGURATION<br />
//***********************************************************************<br />
var state_log = "Waiting";<br />
var motor_state = 0;<br />
var step_pointer = 10;<br />
var my_watch_dog = 0;<br />
var ret = 0;<br />
var power = 0;<br />
var LOOP_DELAY = 2000; // Main Loop Delay<br />
var WATCH_DOG = 20;<br />
<br />
<br />
//***********************************************************************<br />
// Function: refreshDisplay()<br />
//*********************************************************************** <br />
function refreshDisplay()<br />
{<br />
$('#field_1').text( "Step_Pointer = " + step_pointer.toString() );<br />
$('#field_2').text( "Message = " + state_log ); <br />
$('#field_3').text( "Return = " + ret.toString() ); <br />
$('#field_4').text( "Watch_Dog = " + my_watch_dog.toString() ); <br />
$('#field_5').text( "Motor = " + motor_state.toString() ); <br />
$('#field_6').text( "Power = " + power.toString() + " Watts" ); <br />
}<br />
<br />
<br />
//********************************<br />
// Function: MOTOR_ON<br />
//******************************** <br />
function Motor_On( )<br />
{<br />
step_pointer = 100;<br />
}<br />
<br />
<br />
//********************************<br />
// Function: MOTOR_OFF<br />
//******************************** <br />
function Motor_Off( )<br />
{ <br />
step_pointer = 200;<br />
}<br />
<br />
<br />
//********************************<br />
// Function: Main Loop<br />
//******************************** <br />
$(document).ready( function ()<br />
{<br />
<br />
setInterval( function()<br />
{<br />
<br />
//**************************************************<br />
// WATCH DOG CONTROL<br />
//**************************************************<br />
my_watch_dog++;<br />
if ( my_watch_dog > WATCH_DOG ) {<br />
my_watch_dog = 0;<br />
step_pointer = 200;<br />
} <br />
<br />
switch ( step_pointer )<br />
{<br />
//*******************************<br />
// WAITING<br />
//*******************************<br />
case 10:<br />
my_watch_dog = 0;<br />
break;<br />
<br />
<br />
//*******************************<br />
// MOTOR ON<br />
//******************************* <br />
case 100:<br />
ret = NearAPIjs( "DIG_OUTPUT", device_1, 0, 1 );<br />
<br />
if( ret == 1 ) {<br />
my_watch_dog = 0;<br />
step_pointer = 110;<br />
}<br />
break;<br />
<br />
<br />
case 110:<br />
ret = NearAPIjs( "RMS_INPUT_CONFIG", device_1, 1, 1100 ); <br />
<br />
if( ret != "WAIT" ) {<br />
my_watch_dog = 0; <br />
step_pointer = 120;<br />
}<br />
break; <br />
<br />
<br />
case 120:<br />
ret = NearAPIjs( "RMS_INPUT", device_1, 1, 0 ); <br />
<br />
if( ret != "WAIT" && ret > 10 ) {<br />
motor_state = "ON";<br />
my_watch_dog = 0; <br />
step_pointer = 130;<br />
}<br />
break; <br />
<br />
<br />
case 130:<br />
ret = NearAPIjs( "RMS_INPUT", device_1, 1, 0 );<br />
<br />
if( ret != "WAIT" ) {<br />
power = Math.round( ret * (1100 / 1023) / 1000 * (5 / 2) * 220 * 0.75 );<br />
my_watch_dog = 0; <br />
step_pointer = 130;<br />
}<br />
break; <br />
<br />
<br />
//*******************************<br />
// MOTOR OFF<br />
//******************************* <br />
case 200: <br />
ret = NearAPIjs( "DIG_OUTPUT", device_1, 0, 0 );<br />
<br />
if( ret == 0 ) {<br />
my_watch_dog = 0;<br />
step_pointer = 210;<br />
}<br />
break;<br />
<br />
<br />
case 210:<br />
ret = NearAPIjs( "RMS_INPUT", device_1, 1, 0 ); <br />
<br />
if( ret != "WAIT" && ret < 10 ) {<br />
motor_state = "OFF";<br />
my_watch_dog = 0;<br />
step_pointer = 10;<br />
}<br />
break;<br />
<br />
}<br />
refreshDisplay();<br />
<br />
}, 1000 ); <br />
<br />
});<br />
<br />
<br />
<br />
</script><br />
</head><br />
<br />
<body><br />
<br />
<!-- ******************************************************************** --> <br />
<!-- * HTML CODE * --> <br />
<!-- ******************************************************************** --> <br />
<br />
<p><b> MOTOR SWITCH DEMO </b></p><br />
<br />
<div id="field_1">field_1</div><br />
<br /><br />
<div id="field_2">field_2</div><br />
<br /><br />
<div id="field_3">field_3</div><br />
<br /><br />
<div id="field_4">field_4</div><br />
<br /><br />
<div id="field_5">field_5</div><br />
<br /><br />
<div id="field_6">field_6</div><br />
<br /><br />
<br /><br />
<button onclick="Motor_On()">MOTOR ON</button><br />
<br /><br />
<br /><br />
<button onclick="Motor_Off()">MOTOR OFF</button><br />
<br />
</body><br />
</html><br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Blinking_LED&diff=137Blinking LED2018-03-29T21:00:25Z<p>Nearwiki: Created page with " This simple example shows how to implement an infinite loop in the JavaSript code running on a Browser. File:hello_world_6.png ---- ===JavaScript Code=== <br /> In..."</p>
<hr />
<div><br />
This simple example shows how to implement an infinite loop in the JavaSript code running on a Browser.<br />
<br />
<br />
[[File:hello_world_6.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===JavaScript Code===<br />
<br /><br />
<br />
In order to run this code you should copy the following code into a file, save it with html extension and run it in your browser. Additionally you should replace the device_ID, user and password in this file. <br />
<br />
<br />
<pre><br />
<br />
<!DOCTYPE html><br />
<br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<script><br />
// ****************************************************************************************************************************** <br />
// * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net *<br />
// * Description: This simple example shows how to implement an infinite loop in the JavaSript code running on a Browser *<br />
// * Support: info@nearbus.net *<br />
// * *<br />
// * REVISION HISTORY *<br />
// * v0.1 - 09-08-13 - Initial Release *<br />
// * v0.2 - 14-10-13 - Upgrade to support nearapi_0v5 *<br />
// ******************************************************************************************************************************<br />
<br />
// ********************************************************************************<br />
// * IMPORTANT *<br />
// * Be careful to avoid run more than one scripts simultaneously !!! *<br />
// * Don't forget CLOSE the running script before start a new or modified script. *<br />
// * The NearBus system can run multiple scripts but the system output will be *<br />
// * the mix of all running sessions. * <br />
// ********************************************************************************<br />
<br />
// **********************************************************************<br />
// * To run this example you should replace the following parameters *<br />
// * device_id Your device ID, or.. devices ID :) *<br />
// * user Your NearBus Web user *<br />
// * pass Your NearBus Web password *<br />
// **********************************************************************<br />
<br />
var device_id = "NB100***"; // Your device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
var sysEnable;<br />
<br />
function sysStop() {<br />
sysEnable = 0;<br />
}<br />
<br />
function sysStart() {<br />
sysEnable = 1;<br />
sysControl(); <br />
}<br />
<br />
function sysControl(e){<br />
<br />
var loop = 0;<br />
var ret = 0;<br />
<br />
setInterval( function()<br />
{<br />
if( sysEnable == 1 ) <br />
{<br />
if( loop == 1 ) {<br />
ret = NearAPIjs( "DIG_OUTPUT", device_id, 0, 0 );<br />
if ( ret == "DONE" ) {<br />
loop = 0; <br />
} <br />
}<br />
else { <br />
ret = NearAPIjs( "DIG_OUTPUT", device_id, 0, 1 );<br />
if ( ret == "DONE" ) {<br />
loop = 1; <br />
} <br />
}<br />
}<br />
else<br />
{<br />
NearAPIjs( "DIG_OUTPUT", device_id, 0, 0 ); <br />
}<br />
}, 1000); <br />
}<br />
<br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<br /><br />
<p><b> NEARBUS - BLINKING LED EXAMPLE</b></p><br />
<br /><br />
<button onclick="sysStart()">START</button><br />
<br /><br />
<br /><br />
<button onclick="sysStop()">STOP</button><br />
<br />
</body><br />
</html><br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Mobile_Phone_Gauge&diff=136Mobile Phone Gauge2018-03-29T20:59:52Z<p>Nearwiki: Created page with " This JavaScript example show how to implement a gauge indicator adapted for mobile devices. The code implements a single gauge that shows in real time the ADC value in Port_0..."</p>
<hr />
<div><br />
This JavaScript example show how to implement a gauge indicator adapted for mobile devices. The code implements a single gauge that shows in real time the ADC value in Port_0 (Arduino A0). The output value is escalated by a thermistor's transfer function ( Grove Temperature Sensor [http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor] ) used in this example (but any other sensor type could be used). <br />
<br />
<br />
<br />
[[File:Mobile_gauge.png|160px]]<br />
<br />
<br />
----<br />
<br />
===JavaScript Code===<br />
<br /><br />
<br />
To try this example download the following file in you mobile device or computer and execute it. Double click onto the downloaded "html" file in order to run it on your default browser.<br />
<br />
<br />
'''Download:''' NearGauge_v02.rar [http://www.nearbus.net/downloads/js_apps/NearGauge_v02.rar]<br />
<br />
In order to run this example you should edit it (eg. notepad) and replace the following parameters:<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
<br />
<pre><br />
<!DOCTYPE html> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net * --> <br />
<!-- * Description: This JavaScript example show how to implement a gauge indicator adapted for mobile devices. The code * --> <br />
<!-- * implements a single gauge that shows in real time the ADC value in Port_0 (Arduino A0). * --> <br />
<!-- * The system is configured to work with a Grove Temperature Sensor (Thermistor) * --> <br />
<!-- * Support: info@nearbus.net * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * REVISION HISTORY * --><br />
<!-- * v0.1 - 09-08-13 - Initial Release * --> <br />
<!-- * v0.2 - 24-10-13 - Upgrade to support nearapi_v05.js * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
<html><br />
<head><br />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /><br />
<script src="./mscorlib.js" type="text/javascript"></script> <!--ScriptSharp library--><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <!--JQuery library--><br />
<script src="./PerfectWidgets.js" type="text/javascript"></script> <!--Perfectwidgets library--><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script> <!--NearBus library--><br />
<br />
<script><br />
<br />
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// To run this example you should replace the following parameters<br />
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var ret = 0;<br />
var LOOP_DELAY = 1000;<br />
var B = 3975; //B value of the thermistor<br />
<br />
var slider;<br />
window.onload = function ()<br />
{ <br />
var jsonModel = {"Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":null,"Name":"Instrument","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":1,"Color":{"knownColor":35,"name":null,"state":1,"value":0},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Default","ToolTipValue":null,"Visible":true,"Elements":[{"__type":"Circle:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4293256677}},"JSBindingsText":"this.setCenter(new PerfectWidgets.Framework.DataObjects.Vector((this.getInstrument().getByName('Instrument') .getSize() .getWidth()\/2),(this.getInstrument().getByName('Instrument') .getSize() .getHeight()\/2)));\u000a","Name":"Circle1","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":6,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Circle1","ToolTipValue":null,"Visible":true,"Center":{"Height":612.5,"Length":866.20580695352066,"Rotation":0.78539816339744828,"Width":612.5,"X":612.5,"Y":612.5},"Radius":603.125},{"__type":"Circle:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4293256677}},"JSBindingsText":"this.setCenter(this.getInstrument().getByName('Circle1') .getCenter());\u000a","Name":"Circle2","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":6,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Circle1","ToolTipValue":null,"Visible":true,"Center":{"Height":612.5,"Length":866.20580695352066,"Rotation":0.78539816339744828,"Width":612.5,"X":612.5,"Y":612.5},"Radius":568.75},{"__type":"Joint:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":"this.setCenter(this.getInstrument().getByName('Circle1') .getCenter());\u000a","Name":"Joint1","RecalculateAll":false,"Smooth":true,"Stroke":null,"Style":"","ToolTipValue":null,"Visible":true,"Elements":[{"__type":"Scale:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":null,"Name":"Scale1","RecalculateAll":false,"Smooth":true,"Stroke":null,"Style":"","ToolTipValue":null,"Visible":true,"Elements":[{"__type":"Ticks:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":"this.setDistance(this.getInstrument().getByName('Joint1') .getRadius());\u000a","Name":"Ticks1","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":7,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Ticks1","ToolTipValue":null,"Visible":true,"Colorizer":null,"Distance":387.5,"Dock":0,"MaxLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"MinLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"OriginWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"Padding":0,"Divisions":11,"StepWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"SubDivisions":5,"SubTicksPosition":0,"UseDescreteValues":false,"UseRoundValues":false,"Length":56.25,"SubLength":37.5},{"__type":"ScaleLabels:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":"this.setDistance((this.getInstrument().getByName('Joint1') .getRadius()+106.25));\u000a","Name":"ScaleLabels1","RecalculateAll":false,"Smooth":true,"Stroke":null,"Style":"ScaleLabels1","ToolTipValue":null,"Visible":true,"Colorizer":null,"Distance":493.75,"Dock":0,"MaxLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":2,"Value":99},"MinLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"OriginWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"Padding":0,"Font":{"Bold":1,"FamilyName":"Arial","Italic":2,"Size":18,"Strikeout":2,"Underline":2},"Format":{"CurrencyNegativePattern":0,"CurrencyPositivePattern":0,"CurrencySymbol":"$","DateSeparator":".","DecimalPlaces":2,"DecimalSeparator":".","FormatMask":"","FormatStyle":0,"GroupSeparator":" ","NumberNegativePattern":0,"PercentNegativePattern":0,"PercentPositivePattern":0,"UseCultureSettings":true,"UseGroupSeparator":true},"Formula":"","ItemMargins":{},"OddLabelsDistance":0,"Position":1,"ShowSuperposableLabels":true,"TextAlignment":1,"TextAngle":90,"TextRotationMode":1,"Divisions":11,"StepWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"UseRoundValues":false},{"__type":"RangedLevel:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4286545791}},"JSBindingsText":"this.setDistance((this.getInstrument().getByName('Joint1') .getRadius()-93.75));\u000a","Name":"RangedLevel2","RecalculateAll":false,"Smooth":true,"Stroke":null,"Style":"RangedLevel2","ToolTipValue":null,"Visible":true,"Colorizer":null,"Distance":293.75,"Dock":0,"MaxLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"MinLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"OriginWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"Padding":0,"ValueWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"Colors":[],"Divisions":0,"DivisionsStroke":null,"EndColor":{"knownColor":164,"name":null,"state":1,"value":0},"StartColor":{"knownColor":35,"name":null,"state":1,"value":0},"AlignmentMode":0,"EndWidth":62.5,"StartWidth":62.5},{"__type":"Slider:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":null,"JSBindingsText":null,"Name":"Slider1","RecalculateAll":false,"Smooth":true,"Stroke":null,"Style":"","ToolTipValue":null,"Visible":true,"Elements":[{"__type":"RangedLevel:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4288269823}},"JSBindingsText":"this.setDistance((this.getInstrument().getByName('Joint1') .getRadius()-90.625));\u000athis.setValue(this.getInstrument().getByName('Slider1').getAnimationValue());\u000a","Name":"RangedLevel1","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":4,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Needle1","ToolTipValue":null,"Visible":true,"Colorizer":null,"Distance":296.875,"Dock":0,"MaxLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"MinLimitWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"OriginWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":0,"Value":0},"Padding":0,"ValueWrapper":{"__type":"SmartValueWrapper:#PerpetuumSoft.Instrumentation.Model","Kind":1,"Value":48.99466487115037},"Colors":[],"Divisions":0,"DivisionsStroke":null,"EndColor":{"knownColor":164,"name":null,"state":1,"value":0},"StartColor":{"knownColor":35,"name":null,"state":1,"value":0},"AlignmentMode":0,"EndWidth":56.25,"StartWidth":56.25},{"__type":"Needle:#PerpetuumSoft.Instrumentation.Model","Active":true,"BreakEventsBubbling":false,"CssClass":{},"Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4288269823}},"JSBindingsText":"this.setStartPoint(this.getInstrument().getByName(\"Slider1\").getPosition(0));\u000athis.setEndPoint(this.getInstrument().getByName(\"Slider1\").getPosition((this.getInstrument().getByName('Joint1') .getRadius()+50)));\u000a","Name":"Needle1","RecalculateAll":false,"Smooth":true,"Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":4,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1},"Style":"Needle1","ToolTipValue":null,"Visible":true,"EndPoint":{"Height":200.48791367725869,"Length":506.70371667123413,"Rotation":0.40679824770497075,"Width":465.35282631330648,"X":465.35282631330648,"Y":200.48791367725869},"StartPoint":{"Height":612.5,"Length":866.20580695352066,"Rotation":0.78539816339744828,"Width":612.5,"X":612.5,"Y":612.5},"EndWidth":0,"NeedlePoints":[],"ShowMode":0,"StartWidth":62.5}],"MaxLimit":{"Kind":0,"Value":0},"MinLimit":{"Kind":0,"Value":0},"Step":0,"Value":48.99466487115037}],"Colorizer":null,"Maximum":110,"Minimum":0,"Reverse":false}],"Margins":{},"Center":{"Height":612.5,"Length":866.20580695352066,"Rotation":0.78539816339744828,"Width":612.5,"X":612.5,"Y":612.5},"Dock":0,"Radius":387.5,"StartAngle":90,"TotalAngle":360}],"Enabled":true,"Focused":false,"GridStep":25,"IsFixed":false,"MeasureUnit":{},"Parameters":[],"ShowGrid":true,"Size":{"Height":1225,"Length":1732.4116139070413,"Rotation":0.78539816339744828,"Width":1225,"X":1225,"Y":1225},"SnapToGrid":true,"Styles":[{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":null,"Font":{"Bold":0,"FamilyName":"Microsoft Sans Serif","Italic":0,"Size":10,"Strikeout":0,"Underline":0},"Image":null,"Name":"Default","Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":1,"Color":{"knownColor":35,"name":null,"state":1,"value":0},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1}},{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4293256677}},"Font":null,"Image":null,"Name":"Circle1","Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":6,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1}},{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4286545791}},"Font":null,"Image":null,"Name":"RangedLevel2","Stroke":null},{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":{"__type":"SolidFill:#PerpetuumSoft.Framework.Drawing","Color":{"knownColor":0,"name":null,"state":2,"value":4288269823}},"Font":null,"Image":null,"Name":"Needle1","Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":4,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1}},{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":null,"Font":{"Bold":1,"FamilyName":"Arial","Italic":2,"Size":18,"Strikeout":2,"Underline":2},"Image":null,"Name":"ScaleLabels1","Stroke":null},{"__type":"Style:#PerpetuumSoft.Instrumentation.Styles","Fill":null,"Font":null,"Image":null,"Name":"Ticks1","Stroke":{"__type":"SimpleStroke:#PerpetuumSoft.Framework.Drawing","Width":7,"Color":{"knownColor":0,"name":null,"state":2,"value":4286545791},"DashLenght":5,"DotLenght":1,"SpaceLenght":2,"Style":1}}]}<br />
<br />
var widget = new PerfectWidgets.Widget("root", jsonModel); //creating widget<br />
<br />
slider = widget.getByName("Slider1"); //getting slider object<br />
<br />
///////////////////////////////////<br />
// Function: Main Loop<br />
///////////////////////////////////<br />
setInterval( function()<br />
{ <br />
ret = NearAPIjs( "ADC_INPUT", device_id , 0, 0 ); <br />
if( ret != "WAIT" && ret != "DOWN" && ret != "ERROR" ) { <br />
var resistance = (1023-ret) * 10000/ret; //get the resistance of the sensor;<br />
var temperature = 1 / ( Math.log( resistance/10000)/B+1/298.15)-273.15; //convert to temperature via datasheet <br />
slider.setValue( temperature );<br />
}<br />
}, LOOP_DELAY ); <br />
}<br />
<br />
</script><br />
</head><br />
<br />
<body bgcolor="#000"><br />
<br /><br />
<p><div style="text-align:center; width:950px; font: bold 100px Arial; color:orange;">NEAR GAUGE</div></p><br />
<br /><br />
<div id="root" style="width:950px;height:1320px; border:Opx solid #000"></div><br />
</body><br />
</html><br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Mobile_Remote_Control&diff=135Mobile Remote Control2018-03-29T20:58:55Z<p>Nearwiki: Created page with " This example shows a simple interface (designed to mobile devices) that allows you to turn on and to turn off the 4 digital outputs supported in the VMCU mode. File:Mob..."</p>
<hr />
<div><br />
This example shows a simple interface (designed to mobile devices) that allows you to turn on and to turn off the 4 digital outputs supported in the VMCU mode. <br />
<br />
<br />
<br />
[[File:Mobile_control.png|160px]]<br />
<br />
<br />
<br />
<br />
The following video shows a working implementation of this example<br />
<br />
<html><iframe width="480" height="360" src="//www.youtube.com/embed/NfQp7RnOq1Q?rel=0" frameborder="0" allowfullscreen></iframe></html><br />
<br />
<br />
The following picture shows the prototype used to test this example.<br />
<br />
(note that the smartphone is connected through the mobile network (3G) so the system can be controlled from any place around the world).<br />
<br />
[[File:remote_control.png|450px]] <br />
<br />
<br />
----<br />
<br />
===Javascript Code===<br />
<br /><br />
<br />
To try this example download the following file in you mobile device or computer and execute it. Double click onto the downloaded "html" file in order to run it on your default browser.<br />
<br />
<br />
'''Download:''' NearControl_0v2.rar [http://www.nearbus.net/downloads/js_apps/NearControl_0v2.rar]<br />
<br />
In order to run this example you should edit it (eg. notepad) and replace the following parameters:<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
<br />
<pre><br />
<br />
<!DOCTYPE html><br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net * --> <br />
<!-- * Description: This example shows a simple interface (designed to mobile device) that allows you to turn on and to turn off * --> <br />
<!-- * the 4 digital outputs supported in the VMCU mode. * --> <br />
<!-- * This code is intended to show you how to control a remote MCU from a JavaSript code running on a Browser. * --> <br />
<!-- * Support: info@nearbus.net * --><br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * REVISION HISTORY * --><br />
<!-- * v0.1 - 09-08-13 - Initial Release * --><br />
<!-- * v0.2 - 31-10-13 - Upgrade to support nearapi_v05.js * --> <br />
<!-- * * --> <br />
<!-- ****************************************************************************************************************************** --><br />
<br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<script><br />
// +------------------------------------------------------------------------------+<br />
// | WARNING |<br />
// | Be careful to avoid run more than one scripts simultaneously !!! |<br />
// | Don't forget CLOSE the running script before start a new or modified script. |<br />
// | The NearBus system can run multiple scripts but the system output will be |<br />
// | the mix of all running sessions. | <br />
// +------------------------------------------------------------------------------+ <br />
<br />
// +--------------------------------------------------------------------+<br />
// | To run this example you should replace the following parameters |<br />
// | device_id Your device ID, or.. devices ID :) |<br />
// | user Your NearBus Web user |<br />
// | pass Your NearBus Web password |<br />
// +--------------------------------------------------------------------+<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var device_id = "NB100xxx";<br />
<br />
var user = "***"; // Your NearBus Web user<br />
var pass = "***"; // Your NearBus Web password<br />
<br />
var LOOP_DELAY = 500; // Main Loop Delay in ms<br />
var WATCH_DOG = 20; // Watch Dog TTL<br />
<br />
var state_log = "R E A D Y";<br />
<br />
//////////////////////////////////<br />
// Persistent Variables<br />
//////////////////////////////////<br />
var step_pointer = 5;<br />
var ret = 0;<br />
var my_watch_dog = WATCH_DOG;<br />
<br />
var channel_id = 0;<br />
var channel_val = 0;<br />
var button_flag = 0;<br />
<br />
function dig_out_on_p0(e) { <br />
channel_id = 0;<br />
channel_val = 1;<br />
button_flag = 1;<br />
}<br />
<br />
function dig_out_off_p0(e) { <br />
channel_id = 0;<br />
channel_val = 0;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_on_p1(e) { <br />
channel_id = 1;<br />
channel_val = 1;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_off_p1(e) { <br />
channel_id = 1;<br />
channel_val = 0;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_on_p2(e) { <br />
channel_id = 2;<br />
channel_val = 1;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_off_p2(e) { <br />
channel_id = 2;<br />
channel_val = 0;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_on_p3(e) { <br />
channel_id = 3;<br />
channel_val = 1;<br />
button_flag = 1; <br />
}<br />
<br />
function dig_out_off_p3(e) { <br />
channel_id = 3;<br />
channel_val = 0;<br />
button_flag = 1; <br />
}<br />
<br />
function refreshDisplay() {<br />
$('#field_1').text( state_log ); <br />
}<br />
<br />
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
// Function: Main<br />
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <br />
$(document).ready( function ()<br />
{<br />
<br />
setInterval( function()<br />
{ <br />
<br />
//**************************************************<br />
// WATCH DOG CONTROL<br />
//**************************************************<br />
my_watch_dog--;<br />
if ( my_watch_dog <= 0 )<br />
{<br />
my_watch_dog = WATCH_DOG;<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
//**************************************************<br />
// ERROR CHECK<br />
//**************************************************<br />
if ( ret == "ERROR" )<br />
{<br />
state_log = "E R R O R";<br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
//**************************************************<br />
// DEVICE DOWN<br />
//**************************************************<br />
if ( ret == "DOWN" )<br />
{<br />
state_log = "D O W N"; <br />
ResetNearAPIjs();<br />
step_pointer = 5;<br />
}<br />
<br />
refreshDisplay(); <br />
<br />
switch ( step_pointer )<br />
{<br />
/////////////////////////////////////////////////////////////////////<br />
// [STEP 5] - SYSTEM RESET - TURN OFF HEATER<br />
/////////////////////////////////////////////////////////////////////<br />
case 5: <br />
if( button_flag ) {<br />
state_log = "W A I T . . .";<br />
ret = NearAPIjs( "DIG_OUTPUT", device_id, channel_id, channel_val );<br />
if( ret == "DONE" ) {<br />
my_watch_dog = WATCH_DOG; <br />
button_flag = 0;<br />
state_log = "R E A D Y";<br />
} <br />
}<br />
else {<br />
my_watch_dog = WATCH_DOG; <br />
}<br />
break <br />
} <br />
}, LOOP_DELAY ); <br />
} );<br />
<br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * HTML CODE * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
</script><br />
</head><br />
<br />
<body bgcolor="#000"><br />
<br /><br />
<p><div style="text-align:center; font: bold 50px Arial; color:orange;">NEAR CONTROL</div></p><br />
<p><div id="field_1" style="text-align:center; font: 30px Arial; color:#00FF00;"> </div></p><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#F00;" onclick="dig_out_on_p0()">PIN0 = 1</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#000;" onclick="dig_out_off_p0()">PIN0 = 0</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#F00;" onclick="dig_out_on_p1()">PIN1 = 1</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#000;" onclick="dig_out_off_p1()">PIN1 = 0</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#F00;" onclick="dig_out_on_p2()">PIN2 = 1</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#000;" onclick="dig_out_off_p2()">PIN2 = 0</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#F00;" onclick="dig_out_on_p3()">PIN3 = 1</button></div><br />
<div style="text-align:center; border:1px solid #111;"><button style="width:700px;height:120px; font: bold 60px Arial; color:#000;" onclick="dig_out_off_p3()">PIN3 = 0</button></div><br />
</body><br />
<br />
</html><br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Temperature_Monitor&diff=134Temperature Monitor2018-03-29T20:57:00Z<p>Nearwiki: Created page with "This example shows how to implement a simple real time temperature monitor in JavaScript for a mobile device. This implementation require an Xively account (www.xively.com) in..."</p>
<hr />
<div>This example shows how to implement a simple real time temperature monitor in JavaScript for a mobile device. This implementation require an Xively account (www.xively.com) in order to get the historical data sequence in a chart format. <br />
<br />
<br /><br />
[[File:temp_chart.png|160px]]<br />
<br />
smartphone interface example<br />
<br /><br />
<br /><br />
<br /><br />
'''Note:''' Indeed this example can be used to display any analog value that you can sensing from any on the Arduino's Analog inputs (A0 to A3). We use a LM35 temperature sensor merely as application example. <br />
<br /><br />
<br /><br />
===Xively Configuration (Cosm)===<br />
<br /><br />
This screen allows you send to Cosm (www.xively.com) the values received from or transmitted to the remote device over each channel.<br />
<br />
[[File:temp_chart_xively.png]]<br />
<br />
<br />
* '''Stream ID: ''' This field allows you to set the Xvely's (Cosm) datastream where you want to send the signal.<br />
<br />
* '''IN / OUT:''' This option allows you to indicate if you want to send a readed value (input) from the remote device or the written value (output) to the remote device for each channel.<br />
<br />
* '''Constant and Offset:''' The main advantage of this feature is that it allows you to apply a basic transfer function to your signal before sending it to Xively (Cosm):<br />
<br />
<pre><br />
f(x) = x * K + offset<br />
</pre><br />
<br />
<br />
* '''ON: ''' This option allows you to turn on or off the data feed to Xively (Cosm).<br />
<br />
* '''Xively Feed and API Key:''' This option allows you to configure the required parameters to connect succesfully to www.xively.com.<br />
<br /><br />
<br />
===Configuring the Manual Mode===<br />
<br />
In order to get samples from the sensor in a continous way, you should configure the '''ADC_INPUT''' service in manual mode for the selected channel (the port in which the sensor will be connected). In this example we will use the Channel 0 (pin 3 in an Arduino platform). The following picture shows this configuration.<br />
<br />
<br />
[[File:Manual_mode_xively.png]]<br />
<br />
<br />
----<br />
<br />
===Javascript Code===<br />
<br /><br />
The following code will allow you to display the sensed temperature in a graphical way from a mobile device or desktop computer. In order to run this example, download the following file in you mobile device or computer and execute it. Double click onto the downloaded "html" file in order to run it on your default browser.<br />
<br />
<br />
This example is intended to use an LM35 linear temperature sensor but you can use any sensor that you want (you only should change<br />
conversion factor). In this example a conversion factor of (5000 / 1023) / 10 ) is used because the (10bits) ADC Internal reference<br />
is fixed at 5000mV and the LM35 internal constant is 10mV/ºC.<br />
<br />
Note that the Xively transfer function '''does not affect''' the value read with the ADC_INPUT service.<br />
<br />
<br />
'''Download:''' TemperatureChart_v01.zip [http://www.nearbus.net/downloads/js_apps/TemperatureChart_v01.zip]<br />
<br />
In order to run this example you should edit it (eg. notepad) and replace the following parameters:<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
<br />
<pre><br />
<!DOCTYPE html> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net * --> <br />
<!-- * Description: This simple code shows how to implement a temperature chart indicator on a Smartphone * --> <br />
<!-- * This example requires an Xively account (www.xively.com) in order to record the temperature in a historical way * --> <br />
<!-- * The system is configured to work with a LM35 (lineal Temp Sensor (ºC) * --> <br />
<!-- * Support: info@nearbus.net * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * REVISION HISTORY * --><br />
<!-- * v0.1 - 05-11-13 - Initial Release * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<br />
<script><br />
// +--------------------------------------------------------------------+<br />
// | To run this example you should replace the following parameters |<br />
// | device_id Your device ID, or.. devices ID :) |<br />
// | user Your NearBus Web user |<br />
// | pass Your NearBus Web password |<br />
// +--------------------------------------------------------------------+<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var device_id = "NB100xxx"; // Your device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
var LOOP_DELAY = 2000;<br />
<br />
<br />
window.onload = function ()<br />
{<br />
///////////////////////////////////<br />
// Function: Main Loop<br />
///////////////////////////////////<br />
setInterval( function()<br />
{<br />
ret = NearAPIjs( "ADC_INPUT", device_id , 0, 0, "RONLY" );<br />
if( ret != "WAIT" ) {<br />
var temperature = ( ret * (5000/1023) / 10 ); <br />
$('#field_1').text( temperature.toString() ); <br />
}<br />
}, LOOP_DELAY ); <br />
}<br />
<br />
<br />
</script><br />
<br />
<body bgcolor="#000"><br />
<br /><br />
<p><div style="text-align:center; width:950px"><img src="http://nearbus.net/images/logo_nearbus.png" width="140" heisgth="78"</div></p><br />
<br /><br />
<p><div style="text-align:center; width:950px; font: bold 60px Arial; color:orange;">TEMPERATURE CHART</div></p><br />
<br /><br />
<br />
<!-- this line embed a 750 x 400px feed chart form www.xively.com (former cosm.com) --> <br />
<!-- you should replace the "feed" and the "zone" in order to get the chart from www.xively.com --> <br />
<div id="div_temp_chart_cm"> <img src="https://api.cosm.com/v2/feeds/***your_feed_here***/datastreams/0.png?width=750&height=400&colour=%23f15a24&duration=3hours&show_axis_labels=true&detailed_grid=true&timezone=***your_zone_here***" > </div><br />
<br />
<br /><br />
<br /><br />
<p><div style="text-align:center; width:950px; font: bold 60px Arial; color:orange;">celsius</div></p><br />
<p><div id="field_1" style="text-align:center; width:950px; font: bold 300px Arial; color:orange;">. . . .</div></p><br />
</body><br />
</html><br />
<br />
<br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Power_Monitor&diff=133Power Monitor2018-03-29T20:56:17Z<p>Nearwiki: Created page with "This example shows how to implement a real time Power Monitor in JavaScript for a mobile device. This implementation require an Xively account (www.xively.com) in order to get..."</p>
<hr />
<div>This example shows how to implement a real time Power Monitor in JavaScript for a mobile device. This implementation require an Xively account (www.xively.com) in order to get the historical data sequence in a chart format. <br />
<br />
<br /><br />
[[File:mobile_power_meter.png|160px]]<br />
<br />
smartphone interface example<br />
<br /><br />
<br /><br />
<br /><br />
<br />
===System Implementation===<br />
<br /><br />
This implementation works in manual mode asking the remote agent (Arduino) the power reading in a periodic way. The system use the Cosm Connector to send the reading to Xively in order to show it in a graphical way. On the other hand a independently javascript code running from a mobile device ask to the NearBus system in a periodic way the last power reading to show it on the mobile device. <br />
<br /><br />
<br /><br />
Only two hadware components are needed to implement this real time Power Monitor: An Arduino Board (Ethernet / WiFi) and an AC Current Sensor [http://www.seeedstudio.com/wiki/Non-invasive_AC_current_sensor%2830A_max%29] as showed in the following picture.<br />
<br /><br />
<br /><br />
[[File:arduino_power_monitor.png]]<br />
<br /><br />
<br /><br />
The AC Current Sensor is connected to the A0 analog inpur on the Arduino board.<br />
<br /><br />
<br /><br />
'''IMPORTANT: the current sensor only should be installed on only one power wire (of two). If you place both power wires into the sensor,'''<br />
'''then the reading will be 0 (zero)'''.<br />
<br /><br />
<br />
===Configuring the Manual Mode===<br />
<br />
In order to get samples from the sensor in a continous way, you should configure the '''RMS_INPUT''' service in manual mode for the selected channel (the port in which the sensor will be connected). In this example we will use the Channel 0 (A0 3 in an Arduino platform). The following picture shows this configuration.<br />
<br />
<br />
[[File:manual_mode_power.png]]<br />
<br />
<br />
----<br />
<br />
===Xively Configuration (formerly Cosm)===<br />
<br /><br />
This screen allows you send to Xively (www.xively.com) the values received from or transmitted to the remote device over each channel.<br />
<br />
[[File:xively_config_power.png]]<br />
<br />
<br />
* '''Stream ID: ''' This field allows you to set the Xvely's (Cosm) datastream where you want to send the signal.<br />
<br />
* '''IN / OUT:''' This option allows you to indicate if you want to send a readed value (input) from the remote device or the written value (output) to the remote device for each channel.<br />
<br />
* '''Constant and Offset:''' The main advantage of this feature is that it allows you to apply a basic transfer function to your signal before sending it to Xively (Cosm):<br />
<br />
<pre><br />
f(x) = x * K + offset<br />
</pre><br />
<br />
<br />
* '''ON: ''' This option allows you to turn on or off the data feed to Xively (Cosm).<br />
<br />
* '''Xively Feed and API Key:''' This option allows you to configure the required parameters to connect succesfully to www.xively.com.<br />
<br /><br />
<br /><br />
In this example we use a constant factor of 6.6. This factor is obtained in the following way:<br />
<br />
*'''Power Line tension:''' 220 Vac<br />
*'''Current Sensor Ratio:''' 30:1 (30Aac= 1Vac)<br />
*'''RMS_INPUT scale''': mV (RMS)<br />
<br />
K = 220 * 30 / 1000 = 6.6 [W/mV]<br />
<br />
<br />
'''Note:''' this is a calibration example. In order to calibrate your Power Monitor you should use a well-known resistive load (and adjust the K factor to match its value).<br />
<br /><br />
<br /><br />
The following picture shows a real system power chart (Xively). It is important to remark the amount of information that can be obtained from it. In this example the chart represents a measure of our lab enviroment, where an electric heater (about 1400W) and a small refrigerator (about 175 W) are working together, each with its own power fingerprint, as indicated in red on the Xively output chart (note that a residual power consumption of 196W is always present).<br />
<br />
[[File:xively_power_chart.png|600px]]<br />
<br /><br />
<br /><br />
<br /><br />
<br />
===Javascript Code===<br />
<br /><br />
The following code will allow you to display the sensed power in a graphical way from a mobile device or desktop computer. In order to run this example, download the following file in you mobile device or computer, change the parameters indicated with "****" and execute it. Double click onto the downloaded "html" file in order to run it on your default browser.<br />
<br />
<br />
This example is calibrated to use a 30A AC Current Sensor [http://www.seeedstudio.com/wiki/Non-invasive_AC_current_sensor%2830A_max%29] but you can use any other current sensor sensor that you want (you only should change conversion factor). In this example a conversion factor of 6.6 is used.<br />
<br />
'''Note:''' that the Xively transfer function '''does not affect''' the value read with the RMS_INPUT service.<br />
<br />
<br />
'''Download:''' Power_Monitor_0v1.zip [http://www.nearbus.net/downloads/js_apps/Power_Monitor_0v1.zip]<br />
<br />
In order to run this example you should edit it (eg. notepad) and replace the following parameters:<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
<br />
<pre><br />
<!DOCTYPE html> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * NEARBUS JAVASCRIPT EXAMPLE - www.nearbus.net * --> <br />
<!-- * Description: This simple code shows how to implement a power monitor on a Smartphone * --> <br />
<!-- * This example requires an Xively account (www.xively.com) in order to record the power registers in a historical way * --> <br />
<!-- * The system is configured to work with a AC Current Sensor * --> <br />
<!-- * Support: info@nearbus.net * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<!-- * REVISION HISTORY * --><br />
<!-- * v0.1 - 28-11-13 - Initial Release * --> <br />
<!-- ****************************************************************************************************************************** --> <br />
<html><br />
<head><br />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><br />
<script type="text/javascript" src="PAGE" ></script><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<br />
<script><br />
// +--------------------------------------------------------------------+<br />
// | To run this example you should replace the following parameters |<br />
// | device_id Your device ID, or.. devices ID :) |<br />
// | user Your NearBus Web user |<br />
// | pass Your NearBus Web password |<br />
// +--------------------------------------------------------------------+<br />
<br />
<br />
//////////////////////////////////<br />
// MAIN CONFIGURATION<br />
//////////////////////////////////<br />
var device_id = "NB100xxx"; // Your device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
var LOOP_DELAY = 2000;<br />
var power = 0;<br />
<br />
window.onload = function ()<br />
{<br />
///////////////////////////////////<br />
// Function: Main Loop<br />
///////////////////////////////////<br />
setInterval( function()<br />
{<br />
ret = NearAPIjs( "RMS_INPUT", device_id , 0, 0, "RONLY" );<br />
if( ret != "WAIT" && !isNaN(ret) ) {<br />
power = Math.round( ret * 6.6 ); <br />
$('#field_1').text( power.toString() ); <br />
}<br />
}, LOOP_DELAY ); <br />
}<br />
<br />
<br />
</script><br />
<br />
<body bgcolor="#000"><br />
<br /><br />
<p><div style="text-align:center; width:950px"><img src="http://nearbus.net/images/logo_nearbus.png" width="140" heisgth="78"</div></p><br />
<br /><br />
<p><div style="text-align:center; width:950px; font: bold 60px Arial; color:orange;">POWER MONITOR</div></p><br />
<br /><br />
<br />
<!-- this line embed a 750 x 400px feed chart form www.xively.com (former cosm.com) --> <br />
<!-- you should replace the "feed" and the "zone" in order to get the chart from www.xively.com --> <br />
<br />
<div id="div_temp_chart_cm"> <img src="https://api.cosm.com/v2/feeds/****YOUR_FEED_ID_HERE****/datastreams/****YOUR_CHANNEL_NAME_HERE****.png?width=750&height=400&colour=%23f15a24&duration=3hours&show_axis_labels=true&detailed_grid=true&timezone=****YOUR_ZONE_HERE****" > </div><br />
<br />
<br /><br />
<br /><br />
<p><div style="text-align:center; width:950px; font: bold 60px Arial; color:orange;">watts</div></p><br />
<p><div id="field_1" style="text-align:center; width:950px; font: bold 300px Arial; color:orange;">. . . .</div></p><br />
</body><br />
</html><br />
<br />
<br />
<br />
</pre></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Troubleshooting&diff=132Troubleshooting2018-03-29T20:46:32Z<p>Nearwiki: Created page with "===Troubleshooting your NearBus Connection=== <br /> If your Arduino remains DOWN, make the following verifications: '''ETHERNET CHECK LIST''' '''1- Verify that the gre..."</p>
<hr />
<div>===Troubleshooting your NearBus Connection===<br />
<br /><br />
<br />
If your Arduino remains DOWN, make the following verifications:<br />
<br />
<br />
'''ETHERNET CHECK LIST'''<br />
<br />
'''1- Verify that the green light in the Arduino's Ethernet connector is flashing.'''<br />
<br />
'''2- Verify that your internet connection is Up (if you can surf the internet).'''<br />
<br />
'''3- Verify that your Arduino "user" and "password" are configured Ok (the 8 character password, the Device_ID and the Arduino's MAC).'''<br />
<br />
'''4- Verify that your Arduino's Ethernet MAC address is configured Ok (you can find it a label on the back side of your arduino Ethernet board).'''<br />
<br />
'''5- Reset the Arduino, to ensure that it is properly initialized.'''<br />
<br />
<br />
<br />
'''WiFi CHECK LIST'''<br />
<br />
'''1- Verify that the green light (Link) in the Arduino's WiFi board is ON.'''<br />
<br />
'''2- Verify that your internet connection is Up (if you can surf the internet).'''<br />
<br />
'''3- Verify that your Arduino "user" and "password" are configured Ok (the 8 character password and the Device_ID).'''<br />
<br />
'''4- Verify that your WiFi SSID is configured OK, and the "wifimode" parameter matches with your WiFi router configuration (Open = 0 | WAP2 = 1 | WEP = 2). If you find issues try to configure your wireless LAN in open mode (to test the Arduino connection).'''<br />
<br />
'''5- Remember checking if your WiFi router has configured the MAC Filtering Feature (in this case you should enable the Arduino's WiFi MAC on it !!).'''<br />
<br />
'''6- Reset the Arduino, to ensure that it is properly initialized.'''<br />
<br />
<br />
'''NETWORK TOOL:''' With Advanced IP Scanner you be able to scan all your IP addresses including Wi-Fi network. '''Download App:''' [http://www.advanced-ip-scanner.com]<br />
<br />
<br />
'''IMPORTANT: The NearBus screens do not refresh in an automatic way, so you should reload it in order to get the device status.'''<br />
<br />
<br />
'''REMEMBER:''' If you are experimenting random errors with your code (usually on memory exhaustion conditions), verify that the<br />
#define parameters DEBUG_DATA, DEBUG_BETA and DEBUG_ERROR (in file NearBusxxx_xxx.h) are all set to 0 (in order to deactivate the <br />
output debug messages).<br />
<br />
#define DEBUG_DATA 0 // Set to 1 by default<br />
#define DEBUG_BETA 0<br />
#define DEBUG_ERROR 0<br />
<br />
<br /><br />
<br /><br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=NearAPI_Java_Script_Documentation&diff=131NearAPI Java Script Documentation2018-03-29T20:46:01Z<p>Nearwiki: Created page with " JavaScript API Features ( Alpha ) This page describes the Java Script API features intended to deploy applications in JavaScript code running from a simple browser. ===N..."</p>
<hr />
<div><br />
<br />
JavaScript API Features ( Alpha )<br />
<br />
<br />
This page describes the Java Script API features intended to deploy applications in JavaScript code running from a simple browser.<br />
<br />
<br />
===Near API Code===<br />
<br />
In order to run the NearAPI (v05) you should include the following line in your java script code.<br />
<br /><br />
<br /><br />
<script type='text/javascript' src='http://nearbus.net/downloads/js_apps/nearapi_v05.js'></script><br />
<br />
<br /><br />
'''Note:''' The NearAPIjs will return "DOWN" if the remote device has been disconnected.<br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_OUTPUT===<br />
<br /><br />
This function sets a channel (port) to the specified value. <br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_OUTPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : the value to set (0 or 1).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_INPUT===<br />
<br /><br />
This function reads the value on a specified channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_INPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : the value to set (0 or 1). <br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the specified value (0 or 1) on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===WAIT_DIG_INPUT===<br />
<br /><br />
This function waits for a specified value on a specified channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''WAIT_DIG_INPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : the input value to wait for.<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the read value (1 or 0) on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===ADC_INPUT===<br />
<br /><br />
This function reads the analog value with 10 bit resolution on a specified channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''ADC_INPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : the value to set (0 or 1).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, a 10 bits Analog Input [ 0 to 1023 ] on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===ADC_INPUT_CONFIG===<br />
<br /><br />
This function configures the ADC reference value to 1100mV or 5000mV (default).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''ADC_INPUT_CONFIG'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : this argument (set to 1100) allows to configure the 1100mV internal reference (Not available on Arduino Leonardo). The default is 5000mV as ADC reference (or 3300mv on 3.3V boards).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===RMS_INPUT===<br />
<br /><br />
This function returns the '''True RMS''' value of the channel signal. It is indicated to measure signal up to 60 Hz and a peak signal value up tp 5000 mV. It is supported on PINs A0 to A6 on Arduino Platforms. <br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''RMS_INPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : None <br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the True RMS value of a balanced input signal (without DC component). on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===RMS_INPUT_CONFIG===<br />
<br /><br />
This function configures the ADC reference value to 1100mV or 5000mV (default).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''RMS_INPUT_CONFIG'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : this argument (set to 1100) allows to configure the 1100mV internal reference (Not available on Arduino Leonardo). The default is 5000mV as ADC reference (or 3300mv on 3.3V boards).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===PWM_OUTPUT===<br />
<br /><br />
This function generates a Pulse Width Modulated output (it allows to control servo motors).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''PWM_OUTPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : it ranges from 800 to 2200 (the standard servomotor duty cycle).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===PULSE_OUTPUT===<br />
<br /><br />
This function generates Programmable Pulse Output of "x" milliseconds.<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''PULSE_OUTPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : it represents the pulse duration in milliseconds. It ranges from 1 to (2^32) ( 1ms to 50 days ).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===GET_PULSE_OUTPUT===<br />
<br /><br />
Returns the pulse output level (to figure out if the pulse has finished).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''GET_PULSE_OUTPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : None<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the pulse output value (1 while the pulse is UP and 0 when it has finished), "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===TRIGGER_INPUT===<br />
<br /><br />
This function caches a trigger pulse on a digital input channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''TRIGGER_INPUT'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : null.<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, 1 if a trigger was caught or 0 if not, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===TRIGGER_INPUT_CONFIG===<br />
<br /><br />
This function configures the the trigger pulse edge.<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''TRIGGER_INPUT_CONFIG'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx )<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : it allows to configure the pulse edge: [1 -> rising_edge] [0 -> falling_edge].<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_COUNTER===<br />
<br /><br />
This function counts pulses on the selected channel (over a specified period of time).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_COUNTER'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : None<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the accumulated input pulses (on falling edges) over a specified period of time ( from 1 to 50 days ), "ERROR" if error.<br />
<br />
<br />
<br />
'''Features'''<br />
* It works in steps of 5 ms (system accuracy). The input is configured with a '''Pull-Up resistor''' (20 K), intended to work with dry-contact switchs and open collector devices. <br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_COUNTER_CONFIG===<br />
<br /><br />
This function allows to set the counter period.<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_COUNTER_CONFIG'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : the counting period in ms, it ranges from 1 to 2^32( from 1ms to 50 days ).<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_ACCUMULATOR===<br />
<br /><br />
This function accumulates pulses on an input channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_ACCUMULATOR'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : : it returns the accumulated pulses on the selected channel since last reset.<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, the accumulated input pulses (on falling edges) on successful, "ERROR" if error.<br />
<br />
<br />
<br />
'''Features'''<br />
* The NearBus will retains the accumulated pulses even if the remote device is reseted.<br />
* It works in steps of 5 ms (system accuracy). The input is configured with a '''Pull-Up resistor''' (20 K), intended to work with dry-contact switchs and open collector devices.<br />
<br /><br />
<br /><br />
----<br />
<br />
===DIG_ACCUMULATOR_RESET===<br />
<br /><br />
This function resets the accumulator (sets to 0) on a specified channel (port).<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_ACCUMULATOR_RESET'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform (MCU) port.<br />
<br />
'''''value''''' : 0<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===NearTestAPIjs ( )===<br />
<br /><br />
This basic function allows you to use API commands in a "raw way" ( it is mainly intended to be used for testing and debugging ).<br />
<br />
'''''Syntax''''' : NearTestAPIjs ( (string) "service", (string) "method", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''DIG_OUTPUT, DIG_INPUT, WAIT_DIG_INPUT, ADC_INPUT, ADC_INPUT_CONFIG, RMS_INPUT, RMS_INPUT_CONFIG, PWM_OUTPUT, PULSE_OUTPUT, GET_PULSE_OUTPUT, TRIGGER_INPUT, TRIGGER_INPUT_CONFIG, DIG_COUNTER, DIG_COUNTER_CONFIG, DIG_ACCUMULATOR, DIG_ACCUMULATOR_RESET'''.<br />
<br />
'''''method''''' : '''POST''' or '''GET'''.<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : the microcontroller platform port.<br />
<br />
'''''value''''' : the value to set (with POST), nothing (with GET).<br />
<br />
'''''Return''''' : none.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===Near_Timer ( )===<br />
<br /><br />
This function allows to implement a delay of "x" seconds in the user's main loop.<br />
<br />
'''''Syntax''''' : Near_Timer ( seconds, command );<br />
<br />
'''''seconds''''' : the number of seconds to count.<br />
<br />
'''''command''''' : "RUN" and "RESET"(resets the timer).<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===RESET_CHANNEL===<br />
<br /><br />
<br />
This function resets a specified channel (port).<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===RESET_MANUAL===<br />
<br /><br />
This function resets the manual mode for the specified device.<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value );<br />
<br />
'''''service''''' : '''RESET_MANUAL'''<br />
<br />
'''''device_id''''' : the NearBus device identifier ( NB100xxx ).<br />
<br />
'''''channel''''' : set to 0.<br />
<br />
'''''value''''' : set to 0.<br />
<br />
'''''Return''''' : (string/int) this function returns "WAIT" while no data available, "DONE" on successful, "ERROR" if error.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===SET_POOLING_TIME===<br />
<br /><br />
This function allows to change the NearBus pooling time period.<br />
<br />
Not implemented.<br />
<br />
<br /><br />
<br /><br />
----<br />
<br />
===API SPECIAL FEATURES===<br />
<br /><br />
<br />
'''MODE PARAMETER'''<br />
<br />
'''''Syntax''''' : NearAPIjs ( (string) "service", (string) "device_id", (int) channel, (int) value, '''"MODE"''' );<br />
<br />
The NearAPI supports the following modes:<br />
<br />
'''"FULL"''' This option allows full access to the API features (Read/Write). It is the API default mode.<br />
<br />
'''"RONLY"''': This option allows to GET a value as a Read-Only call. That means that you will get the last value in the NearBus data base, but no update will be sent to the remote device.<br />
<br />
'''"FLUSH"''' This option will "flush" any previous request queued for the specified device (it works with GET and POST methods).<br />
<br />
<br /><br />
<br /><br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=NearAPI_REST_Documentation&diff=130NearAPI REST Documentation2018-03-29T20:45:22Z<p>Nearwiki: Created page with "<br /> ===REST API - VMCU MODE=== <br /> In order to offer the simplest interface the NearBus system offers a RESTful API to control the remote devices. As RESTful implementat..."</p>
<hr />
<div><br /><br />
===REST API - VMCU MODE===<br />
<br /><br />
In order to offer the simplest interface the NearBus system offers a RESTful API to control the remote devices. As RESTful implementation the API uses the GET method to read values from the remote device (eg. Digital Inputs or ADC) and uses the POST method to write values to the remote device (eg. Digital Outputs a PWM).<br />
<br />
<br />
'''PoGET Feature (POST over GET)'''<br />
<br />
In order to improve the code simplicity the NearBus system implements the PoGET feature that allows to use the GET method as a POST (adding the "method=POST" argument on the URL). This feature allows you to control your remote devices avoiding use XMLHttpRequest() and so bypassing the Same Origin Policy in your JavaScript code (and even using the browser's address bar as a traditional command line interface).<br />
<br />
<br />
[[File:Hello_world_7c.png|thumb|center|1200px]]<br />
<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===Enhanced NearAPI Features ( Alpha )===<br />
<br /><br />
This page describes the last API enhanced features intended to deploy applications in JavaScript code running from a simple browser.<br />
<br />
<br />
The API REST syntax call is the following:<br />
<br />
'''Standard API'''<br />
'''http://nearbus.net/v1/api_vmcu_jsb/NB100***?user=****&pass=****&channel=0&service=DIG_OUTPUT&value=1&method=POST&reqid=0'''<br />
<br />
'''http://nearbus.net/v1/api_vmcu_jsb/NB100***?pin=****&channel=0&service=DIG_OUTPUT&value=1&method=POST&reqid=0'''<br />
<br />
<br />
'''Secure API (SSL)'''<br />
'''https://nearbus.net/v1/api_vmcu_jsb/NB100***?user=****&pass=****&channel=0&service=DIG_OUTPUT&value=1&method=POST&reqid=0'''<br />
<br />
'''https://nearbus.net/v1/api_vmcu_jsb/NB100***?pin=****&channel=0&service=DIG_OUTPUT&value=1&method=POST&reqid=0'''<br />
<br />
<br />
'''Note:''' in order to use the secure API (SSL) you should accept the NearBus certificated (a warning message could be displayed, because your browser will not recognize it).<br />
<br />
<br />
* '''user:''' Your NearBus Web user<br />
* '''pass:''' Your NearBus Web password<br />
* '''pin:''' The NearBus PIN defined at device level (it replace user and password credentials)<br />
* '''channel:''' NearBus channel [0-3]<br />
* '''value:''' Service value (if apply)<br />
* '''method:''' GET (read) / POST (write)<br />
* '''reqid:''' Transaction identifier, to match a request and its response. For example to read a sensor with ADC_INPUT through multiple GETs, or to set (with feedback) an output through DIG_OUTPUT using a POST and a GET.<br />
<br />
<br />
* This API service returns immediately the "actual value" in the NearBus Data Base.<br />
<br />
* The API requires a “request_id” ('''reqid''') in order to match the request with the response. If the "request_id" does not match with the "request_id" in the NearBus Data Base, the API return "NULL" (this means that you always will need make two requests in order to obtain a valid value (not NULL). This "twin-call" procedure allows to the API call returns immediately simplifying the way in which the system can be programmed under JavaScript.<br />
<br />
* The NearAPI always will return a single value (a number or NULL if is no valid value).<br />
<br />
<br />
<br />
<br />
'''SUPPORTED API SERVICES''' (supported on Arduino agent v08 onwards)<br />
<br />
<br />
----<br />
<br />
===DIG_INPUT===<br />
<br /><br />
* This call returns the digital value in the specified channel (port).<br />
<br />
'''Supported Method:'''<br />
<br />
'''POST:'''<br />
not implemented.<br />
<br />
'''GET:'''<br />
'''Argument:''' None<br />
'''Return:''' this call returns the port digital value [0 or 1].<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===DIG_OUTPUT===<br />
<br /><br />
* This call sets the specified channel (port) to 1 or 0.<br />
<br />
'''Supported Methods:'''<br />
<br />
'''POST:'''<br />
Argument: the digital value to set [0 or 1].<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Return: this call returns the set value [0 or 1].<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===ADC_INPUT===<br />
<br /><br />
* This call returns the ADC value with 10 bits resolution.<br />
<br />
'''Supported Methods:'''<br />
<br />
'''POST:'''<br />
Allows to set the ADC reference value to 1100mV or 5000mV.<br />
Argument: the argument value (set to 1100) allows to configure the 1100mV internal reference (Not available on Arduino Leonardo).<br />
The default is 5000mV as ADC reference (or 3300mv on 3.3V boards).<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Return: this call returns a 10 bits Analog Input [ 0 to 1023 ]. <br />
<br />
<br />
<br />
<br />
----<br />
<br />
===PWM_OUTPUT===<br />
<br /><br />
* This call generates a pulse width modulated output (it allows to control servo motors).<br />
<br />
'''Supported Methods'''<br />
<br />
'''POST:'''<br />
Sets the PWM output Duty Cycle [800 to 2200].<br />
Argument: the argument [value] ranges from 800 to 2200 (the standard servomotor duty cycle).<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Returns the PWM configured value.<br />
Argument: None<br />
Return: this call returns the configured value (if Ok) or "NULL" while it is waiting from a remote response.<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===PULSE_OUTPUT===<br />
<br /><br />
* This call generates Programmable Pulse Output of "x" milliseconds.<br />
<br />
'''Supported Methods'''<br />
<br />
'''POST:'''<br />
Argument: the pulse duration should be indicated in the "value" argument [ 1 to 2^32 ] in ms ( from 1ms to 50 days ).<br />
Works in steps of 5 ms (system accuracy).<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Works in steps of 5 ms (system accuracy).<br />
Return: this call returns the pulse output value (1 while the pulse is UP and 0 when it has finished).<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===TRIGGER_INPUT===<br />
<br /><br />
* This call caches a trigger pulse on a digital input PIN.<br />
<br />
'''Supported Methods'''<br />
<br />
'''POST:'''<br />
Allows to set the trigger edge.<br />
Argument: The "value" argument allows to configure the pulse edge: [1 -> rising_edge] [0 -> falling_edge].<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Return: this call returns "1" if a trigger was caught, "0" otherwise.<br />
<br />
<br />
'''Features'''<br />
* The input is configured in '''High Z''' (the external switch should include a Pull-Up or Pull-Down resistor).<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===RMS_INPUT===<br />
<br /><br />
* This call returns the True RMS value of a port signal. Indicated to measure signal up to 60 Hz and a peak signal value of 1.1 Volt. Supported on PINs A0 to A6 on Arduino Platforms.<br />
<br />
'''Supported Methods'''<br />
<br />
'''POST:'''<br />
Allows to set the ADC peak reference value to 1100mV or 5000mV.<br />
Argument: the argument value (set to 1100) allows to configure the 1100mV internal reference (Not available on Arduino Leonardo).<br />
The default is 5000mV as ADC reference (or 3300mv on 3.3V boards).<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Returns the TRUE RMS (Root Mean Square) value of the input signal in [mV].<br />
Argument: None<br />
Return: this call returns the True RMS value of a balanced input signal (without DC component).<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===DIG_COUNTER===<br />
<br /><br />
* This call counts pulses on the selected channel.<br />
<br />
'''Supported Methods:'''<br />
<br />
'''POST:'''<br />
Allows to set the counter period in ms<br />
Argument: the Period should be indicated in the "value" argument [ 1 to 2^32 ] in ms ( from 1ms to 50 days ).<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Return: this call returns the accumulated input pulses (on falling edges) over a specified period of time ( from 1 to 50 days ).<br />
<br />
<br />
<br />
'''Features'''<br />
* Works in steps of 5 ms (system accuracy). The input is configured with a '''Pull-Up resistor''' (20 K), intended to work with dry-contact switchs and open collector devices.<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===DIG_ACCUMUL===<br />
<br /><br />
* This call accumulates pulses on an input channel.<br />
<br />
'''Supported Methods:'''<br />
<br />
'''POST:'''<br />
Argument: a POST is used to reset the accumulated pulses.<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
'''GET:'''<br />
Argument: None<br />
Return: this call returns the accumulated pulses on the selected channel since last reset ( POST ).<br />
<br />
<br />
'''Features'''<br />
* The NearBus will retains the accumulated pulses even if the remote device is reseted.<br />
* Works in steps of 5 ms (system accuracy). The input is configured with a Pull-Up resistor (20 K), intended to work with dry-contact switchs and open collector devices.<br />
<br />
<br />
<br />
----<br />
<br />
===RESET_PORT===<br />
<br /><br />
* This call resets '''All''' services on a specified channel (port).<br />
<br />
'''Supported Method:'''<br />
<br />
'''POST:'''<br />
Argument: None<br />
Return: (string) "DONE" (the request was successfully registered) or "ERROR" (the request was not registered).<br />
<br />
<br />
* A new '''reqid''' identifier should be used to guarantee a consistent response.<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===MY_NBIOS_0===<br />
<br /><br />
* This service will trigger the user defined function (MyDriver_0) in the Arduino code.<br />
<br />
'''Supported Method:'''<br />
<br />
'''POST:'''<br />
Argument: the value to send, that will be received in the Arduino code as "setValue" argument.<br />
Return: (string) the Arduino user function returned value (in the *pRetValue pointer) or "ERROR".<br />
<br />
<br />
* A new '''reqid''' identifier should be used to guarantee a consistent response, (or "0" to disable the "reqid" matching feature).<br />
<br />
<br />
----</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=App_Note_1218_-_Hello_World&diff=129App Note 1218 - Hello World2018-03-29T20:44:28Z<p>Nearwiki: Created page with " This App Note describes step by step how to configure an Arduino Ethernet board to control a LED from the Cloud, (the "Hello World" example in the microcontroller's world). T..."</p>
<hr />
<div><br />
This App Note describes step by step how to configure an Arduino Ethernet board to control a LED from the Cloud, (the "Hello World" example in the microcontroller's world). This trivial example is intended to introduce you the way how the NearBus system works.<br />
<br />
<br />
'''Mobile App Example'''<br />
<br />
Downloading a simple html (JavaScript) file in your mobile device you will be able to control your Arduino in an easy and reliable way (as showed in the Step 8)<br />
<br />
[[File:Mobile_control.png|70px]]<br />
<br />
<br />
<br />
There is no PC or gateway involved in this implementation. The Arduino will connect directly to the NearHub Server through the internet access router and you will be able to control it from your web browser.<br />
<br />
<br />
===Required Components===<br />
<br /><br />
<br />
To implement this App Note you will need:<br />
<br />
'''- 1 Arduino Ethernet Board'''<br />
<br />
'''- 1 LED'''<br />
<br />
'''- 1 Current limiter Resistor''' ( 330 Ohms or similar value)<br />
<br />
'''- 1 Ethernet Internet connection''' (with a RJ45 cable)<br />
<br />
'''- 1 Mobile Device (Android, iPhone)''' - (optional)<br />
<br />
'''- Implementation time:''' 20 min<br />
<br />
'''- Difficulty Level:''' Low <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 1 - Sing up a new user===<br />
<br /><br />
<br />
Go to the SIGN UP screen and set up a new user. Only the '''username''', email and '''password''' are required to setup your new account.<br />
<br />
<br />
[[File:hello_world_1.png]]<br />
<br />
<br />
Then login into the NearBus website using your new user and password.<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 2 - Define a New Device===<br />
<br /><br />
<br />
From the top menu bar select the NEW DEVICE option to create a new device.<br />
<br />
To setup the new device you should configure the followings field in order to define it. Take in account that only the SHARED SECRET field is mandatory (the password). The other fields are optional, so it is not necessary to configure they for this first example.<br />
<br />
<br />
[[File:hello_world_2a.png]]<br />
<br />
<br />
<br />
<br />
'''- Device Name:''' optional (eg. My Device)<br />
<br />
'''- Location: nothing'''<br />
<br />
'''- Function: nothing'''<br />
<br />
'''- Shared Secret:''' Mandatory (length of 8). It is the same as you should configure in the Arduino (eg. 12345678)<br />
<br />
'''- Callback Function:''' nothing<br />
<br />
'''- Refresh Rate:''' nothing (default 1000ms)<br />
<br />
<br />
<br />
'''Note:''' When you create a new device, the NearBus system will generate a unique device ID (likeNB1xxxxx) that will be showed in the DEVICE LIST screen (do not confuse it with the DEVICE NAME field !!).<br />
<br />
Take in account that you will need to configure this ID in the Arduino's code as explained in the following step.<br />
<br />
<br />
<br />
[[File:hello_world_2b.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 3 - Download and Install the NearAgent code library===<br />
<br /><br />
<br />
a- Download the Arduino NearBus library from the following link:<br />
<br />
<br />
DOWNLOAD ARDUINO ETHERNET AGENT [http://www.nearbus.net/downld.html]<br />
<br />
<br />
<br />
[[File:hello_world_3a.png]]''<br />
<br />
Note: The version numbers and file names are illustrative and can be different from the last release.'' <br />
<br />
<br />
'''Note:''' This code only include a simple implementation of the NearBIOS features in order to simplify its understanding.<br />
<br />
<br />
b- Upload it to the Arduino Ethernet board, you only have to unzip the file and copy it into the Arduino library folder (remember to restart the Arduino IDE).<br />
<br />
<br />
<br />
[[File:hello_world_3b.png]]<br />
<br />
''Note: The version numbers and file names are illustrative and can be different from the last release.'' <br />
<br />
<br />
'''IMPORTANT:''' Remember to check the decompressed library folder in order to avoid double nested folders. Depending on the decompressing option selected you can obtain nested folders (like NearBusEther0v2x/ NearBusEther0v2x/...). In this case you only should install then second-level folder (NearBusEther0v2x/) in your Arduino library in order to avoid an error at compilation time.<br />
<br />
For a detailed information about how install Arduino's library please follow this instructions: [http://arduino.cc/en/Guide/Libraries]<br />
<br />
<br />
c- Load the "Hello World" code from the example section in the IDE menu.<br />
<br />
<br />
<br />
[[File:hello_world_3c.png]]<br />
<br />
''Note: The version numbers and file names are illustrative and can be different from the last release.'' <br />
<br />
<br />
<br />
----<br />
<br />
===STEP 4 - Set the Agent's configuration===<br />
<br /><br />
<br />
a- Change the configuration settings in the Arduino main code, as showed in the next picture:<br />
<br />
'''- Device_ID:''' Unique device identifier generated by the system (you can find it in the Device List screen).<br />
<br />
'''- Password:''' User generated (shared secret).<br />
<br />
'''- Arduino Ethernet MAC:''' Ethernet MAC Address (*).<br />
<br />
<br />
[[File:hello_world_4.png]]<br />
<br />
(*) ''current Ethernet shields come with a sticker indicating the MAC address you should use with them. For older shields without a dedicated MAC address, inventing a random one should work, but don't use the same one for multiple boards (source: Arduino's Web).''<br />
<br />
<br />
<br />
b- Compile and upload the code "Hello World" to the Arduino Ethernet board.<br />
<br />
<br />
'''Important:''' Because in this example the Arduino will work in VMCU mode, you will not need modify the Arduino's code. The Arduino will be controlled from the Cloud through the NearBIOS.<br />
<br />
<br />
'''Note:''' The default Agent IP configuration is DHCP. If you want to use static IP Addressing, you should set the STATIC_IP parameter to 1 and configure your IP LAN parameters, in the main sketch (available in Hello_World_Ether v0.5L).<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 5 - Verify that your Arduino is UP===<br />
<br /><br />
<br />
In the Device List screen, your Arduino should go Up (green) in a few seconds.<br />
<br />
<br />
<br />
[[File:hello_world_5.png]]<br />
<br />
<br />
<br />
<br />
'''Important:''' The screen does not refresh in an automatic way, so you should reload it in order to get the device status.<br />
<br />
<br />
'''Troubleshooting :('''<br />
<br />
If your Arduino remains DOWN, make the following verifications:<br />
<br />
1- Verify that the green light in the Arduino's Ethernet connector is flashing.<br />
<br />
2- Verify that your internet connection if Up (if you can surf by internet).<br />
<br />
3- Verify that your Arduino is configured Ok (the 8 character password, the Device_ID and the Arduino's MAC).<br />
<br />
4- Reset the Arduino, to ensure that it is properly initialized.<br />
<br />
<br />
'''REMEMBER:''' If you are experimenting random errors with your code (usually on memory exhaustion conditions), verify that the #define parameters DEBUG_DATA, DEBUG_BETA and DEBUG_ERROR (in file NearBusxxx_xxx.cpp) are all set to 0 (in order to deactivate the output debug messages).<br />
<br />
<br />
----<br />
<br />
===STEP 6 - Wire your Arduino===<br />
<br /><br />
<br />
Wire a LED with a current limiter resistor to the Arduino's Pin 3 (NearBus Channel 0).<br />
<br />
<br />
<br />
[[File:hello_world_6.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 7 - Controlling a LED from NearBus===<br />
<br /><br />
<br />
a- Select the "CONFIG DEVICE" option in the drop-down menu from the DEVICE LIST screen.<br />
<br />
<br />
[[File:hello_world_7a.png]]<br />
<br />
<br />
b- Put the Channel 0 in Manual Mode (check the MAN check-box for Channel 0).<br />
<br />
<br />
c- Control your LED: Change the FUNCTION drop-down menu to UP, and the Arduino's Pin 3 should go UP and the LED will light :). <br />
<br />
<br />
<br />
[[File:hello_world_7b.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===STEP 8 - Controlling a LED from your Mobile Device===<br />
<br /><br />
'''REMOTE CONTROL (Java Script example for mobile devices )'''<br />
<br />
The following Remote Control HTML example has been designed to be used from mobile devices (Smartphones or Tablets). It will allow you to switch ON and switch OFF up to four power devices.<br />
<br />
To try this example download the following code in you mobile device or computer and execute it. Double click onto the downloaded "html" file in order to run it on your default browser.<br />
<br />
<br />
'''Download:''' NearControl_0v2.rar [http://www.nearbus.net/downloads/js_apps/NearControl_0v2.rar]<br />
<br />
In order to run this example you should edit it (eg. notepad) and replace the following parameters:<br />
var device_id = "NB100xxx"; // You NearBus Device ID<br />
var user = "****"; // Your NearBus Web user<br />
var pass = "****"; // Your NearBus Web password<br />
<br />
<br />
'''Mobile Device Interface'''<br />
<br />
[[File:Mobile_control.png|160px]]<br />
<br />
<br />
----<br />
<br />
===STEP 9 - RESTful API Example===<br />
<br /><br />
<br />
The following example is intended to show you the easy way in which the RESTful API works. It shows how to control the LED (Channel_1/pin 3) from your browser, using the address bar as a line command interface (like a traditional OS shell).<br />
<br />
To turn the LED on enter the following URL in your browser, replacing the argument's values (user, pass, device ) with your own values:<br />
<br />
http://nearbus.net/v1/api_vmcu_jsb/NB100xxx?user=****&pass=****&service=DIG_OUTPUT&channel=0&value=1&method=POST<br />
<br />
<br />
To turn the LED off, change the value argument from 1 to 0 as shown bellow:<br />
<br />
http://nearbus.net/v1/api_vmcu_jsb/NB100xxx?user=****&pass=****&service=DIG_OUTPUT&channel=0&value=0&method=POST<br />
<br />
<br />
<br />
'''As you can see thanks to the RESTful API implementation you will be able to control your devices through a simple web link.'''<br />
<br />
<br />
<br />
[[File:hello_world_7c.png]]<br />
<br />
<br />
<br />
'''Note:''' Is important to remark that the security point of view, the RESTful API can be as secure as a web bank transaction when it implements the same security systems (SSL, certificates, etc.).<br />
<br />
<br />
'''IMPORTANT:''' Because the browsers implement the '''Same Origin Policy''' [http://en.wikipedia.org/wiki/Same_origin_policy], making calls from your local web page to NearBus server with functions like XMLHttpRequest() will not work.<br />
<br /><br />
<br /><br />
----<br />
<br />
===Testing More Features===<br />
<br /><br />
<br />
If you want to try more features available in the functions drop-down menu please refer to the '''HELP''' [http://www.nearbus.net/v1/help_aux.html] section for a detailed description of the NearBIOS features.<br />
<br />
If you are interested in knowing more about this App Note please contact us at: '''info@nearbus.net'''</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=Help&diff=128Help2018-03-29T20:43:45Z<p>Nearwiki: Created page with " The next paragraphs describe the main features that NearBus offer to you, in order to allows you to configure, supervise and troubleshooting the remote devices connections...."</p>
<hr />
<div><br />
The next paragraphs describe the main features that NearBus offer to you, in order to allows you to configure, supervise and troubleshooting the remote devices connections.<br />
<br />
<br />
If you are going to configure the Arduino Ethernet platform for the first time, please try the '''[[App Note 1218 - Hello World]]''' example.<br />
<br />
<br />
----<br />
<br /><br />
===Devices List===<br />
<br /><br />
This screen shows you a list of all devices configured for your user account, allowing you to see quickly which devices are UP and which are DOWN.<br />
<br />
<br />
[[File:screenshot_1.png]]<br />
<br />
<br />
This screen shows you a list of all devices configured for your user account, allowing you to see in a fast way which devices are UP and which are DOWN.<br />
<br />
<br />
From here you can access the following options for the selected device:<br />
<br />
* '''Config Device:''' See the Device Configuration paragraph.<br />
<br />
* '''Edit Device:''' See the New Device / Edit Device paragraph.<br />
<br />
* '''Cosm Config:''' See COSM Configuration paragraph.<br />
<br />
* '''Device Monitor:''' See Device Monitor paragraph.<br />
<br />
<br />
<br />
----<br />
<br />
===Device Configuration===<br />
<br /><br />
This screen allows you to set in manual mode each device and control the basic features of NearBIOS subsystem offers (this option is only available for channels 0 to 3):<br />
<br />
<br />
[[File:screenshot_2.png]]<br />
<br />
<br />
<br />
'''AGENT DEBUG:''' This option allows you to activate and deactivate the remote Agent debug output (the terminal output on the Arduino platform). This option will turn on and turn off the Agent's activity LED (Pin 8 on the Arduino Platform).<br />
<br />
<br />
'''MAN (Manual Mode)'''<br />
<br />
This check allows you to set each channel in Manual Mode (to control it with the function field)<br />
<br />
<br />
'''Functions'''<br />
<br />
*'''UP:''' DIG_OUTPUT=1 - Digital Output<br />
<br />
*'''DOWN:''' DIG_OUTPUT=0 - Digital Output<br />
<br />
*'''DIG_INPUT:''' Digital Input (0 or 1)<br />
<br />
*'''ADC_INPUT:''' 10 bits Analog Input (0 to 1023 for 0 to 1.1V). It uses the internal 1.1V reference<br />
<br />
*'''PWM_OUTPUT:''' Pulse width modulated output expressed in [us] and configured to control servo motors. The typical range for servo motors is from 800 to 2200 [us].<br />
<br />
*'''MY_NBIOS_0:''' This option allows you to trigger the Arduino custom defined function "MyNbios()" in a periodic way. The value set in the "value" field will be sent to the remote "MyNbios()" as argument. This feature is intended to work in conjuntion with the "Cosm Connector".<br />
<br />
<br />
'''Value'''<br />
<br />
This field should be set with the desired value for output functions (DIG_OUT or PWM). When input functions are configured (DIG_IN or ADC)this field returns the read value.<br />
<br />
<br />
'''Channel'''<br />
<br />
The following chart shows how each Arduino's pin is mapped to the channels<br />
<br />
<br />
{| cellpadding="5" cellspacing="0" border="1"<br />
|Channel 0 = Dig_pin 3 + Analog A0<br />
|-<br />
|Channel 1 = Dig_pin 5 + Analog A1<br />
|-<br />
|Channel 2 = Dig_pin 6 + Analog A2<br />
|-<br />
|Channel 3 = Dig_pin 9 + Analog A3 <br />
|}<br />
<br />
<br />
<br />
[[File:screenshot_2b.jpg]]<br />
<br />
<br />
'''Note:''' It is possible to wire up the analog pins with the digital pins (because the analog pin are configured as inputs).<br />
<br />
<br />
<br />
----<br />
<br />
===New Device / Edit Device===<br />
<br /><br />
This screen allows you to create a new device (and delete it).<br />
<br />
<br />
<br />
[[File:screenshot_3.png]]<br />
<br />
<br />
The main fields are:<br />
<br />
* '''Device Name:''' Allows you to set a name ID for your new device (recomended)<br />
<br />
* '''Location:''' Allows you to set the physical location (optional)<br />
<br />
* '''Function:''' Allows you to set the device function (optional)<br />
<br />
* '''Shared Secret:''' Set here the shared secret (mandatory length of 8). The same as you configured in the Arduino<br />
<br />
* '''Callback Function:''' Allows you to define the web service (Back-End) that will work in a call-back mode.<br />
<br />
* '''Refresh Rate:''' Allows you to set the pooling device period [ms]<br />
<br />
<br />
The following fields are only showed in the Edit Device screen:<br />
<br />
<br />
<br />
[[File:screenshot_3b.png]]<br />
<br />
<br />
* '''Configured as VMCU:''' (default) Allows you to configure the VMCU mode (to control the MCU in manual mode)<br />
<br />
* '''Delete Device:''' This option allows you to delete a device<br />
<br />
* '''Device ID:''' It is a unique identifier for each device (NB1xxxxxx) that will be generated by the system (at configuration time and cannot be modified).<br />
<br />
<br />
<br />
----<br />
<br />
===Device Statistics===<br />
<br /><br />
This screen shows you the main statistics of each device (this feature is intended to be used in troubleshooting and system tuning).<br />
<br />
[[File:screenshot_4.png]]<br />
<br />
<br />
<br />
----<br />
<br />
===Xively Configuration (former Cosm)===<br />
<br /><br />
This screen allows you send to Xively (www.xively.com) the values received from or transmitted to the remote device over each channel (this feature is intended to be used in troubleshooting and system tuning)<br />
<br />
[[File:screenshot_5.png]]<br />
<br />
<br />
* '''Stream ID: ''' This field allows you to set the Cosm's datastream where you want to send the signal.<br />
<br />
<br />
* '''IN / OUT:''' This option allows you to indicate if you want to send a readed value (input) from the remote device or the written value (output) to the remote device for each channel.<br />
<br />
<br />
* '''Constant and Offset:''' The main advantage of this feature is that it allows you to apply a basic transfer function to your signal before sending it to cosm:<br />
<br />
<pre><br />
f(x) = x * K + offset<br />
</pre><br />
<br />
<br />
* '''ON: ''' This option allows you to turn on or off the data feed to Cosm.<br />
<br />
<br />
* '''Cosm Feed and API Key:''' This option allows you to configure the required parameters to connect succesfully to www.cosm.com.<br />
<br />
<br />
The following table shows an example of output sent to www.cosm.com (2 channels)<br />
<br />
<br />
<br />
[[File:screenshot_5b.jpg]]<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===X-Control (Xively) NEW!!!===<br />
<br /><br />
This screen allows you interconnect different NearBus device using the Xively Cloud Services as an interconnection HUB (of analog signals). This feature allows to POST data to Xively (WRITE) and to GET data from Xively (READ). Additionally this module allows you to process the signal with three basic transfer functions (Gain, Offset and Deadband).<br />
<br />
The following picture shown the X-CONTROLLER screen configuration fields: <br />
<br />
<br />
[[File:x_control.png]]<br />
<br />
<br />
<br />
* '''Function: ''' This field shown the Function configutaed over the Channel.<br />
<br />
<br />
* '''Manual: ''' This field shows if the channel is on manual mode or not. In order to work with this module the selected Channel should be in manual mode (mandatory).<br />
<br />
<br />
* '''--> :''' Selecting this option allows you to configure that a remote-device's read signal (eg. with ADC_INPUT) be sent to a specific Xively Datastream.<br />
<br />
<br />
* '''<-- :''' Selecting this option allows you to configure that a Xively read signal be sent to the a defined NearBus Function on a specified channel.<br />
<br />
<br />
* '''Gaint, Offset and DeadBand:''' This feature allows you to apply a basic signal processing to the signal before connect it to Xively, or a NearBus Channel:<br />
<br />
<br />
<br />
<pre><br />
f(x) = DeadBand( x * Gain + offset )<br />
</pre><br />
<br />
<br />
The DeadBand() function works as an Hysteresis Transfer Function, generating a digital output signal (1 or 0). The following example shown a generic deadband operation (with a -0,5 deadband not zero centred):<br />
<br />
When the sensed signal drops below the bottom setting value in the hysteresis block (below 21,5 deg. C) , the output will be UP (1). In turn when the temperature rises over the top setting value in the hysteresis block ( over 22,5 deg. C) the output will go DOWN (0).<br />
<br />
<br />
[[File:Hysteresis_window.png]]<br />
<br />
(in this example in order to center the sensed signal around 0 an offset of -21 should be configured)<br />
<br />
<br />
'''IMPORTANT:''' The Deadband function only will work arround 0 (zero). That means that the specified parameter represents 1/2 of the deadband centred on 0. A negative deadband value will generate an inverted output.<br />
<br />
<br />
* '''Filter:''' This feature allows you to apply a Digital Filter to the signal processed value in order to smoothing the output (First Order Digital Filter). The following picture shows a comparison between: (A) An output with filter and (B) and output without filter:<br />
<br />
<br />
[[File:digital_filter_1.png]]<br />
<br />
'''Features:'''<br />
<br />
- The filter output will reach the 90% of its final value in approximately 16 refresh-time slots.<br />
<br />
- The digital filtering is the first function applied in the signal processing chain.<br />
<br />
<br />
<br />
* '''Stream ID: ''' This field allows you to set the Xively datastream where you want to write/read the signal.<br />
<br />
<br />
* '''Value: ''' This field shown the signal value after processing.<br />
<br />
<br />
* '''Connect: ''' This option allows you to "connect" each NearBus channel to/from a Xively Data Stream.<br />
<br />
<br />
* '''Xively Feed and API Key:''' This option allows you to configure the required parameters to connect succesfully to www.xively.com.<br />
<br />
<br />
<br />
'''IMPORTANT: ''' This feature only will work on devices with NearBus release v0.14 onwards.<br />
<br />
<br />
<br /><br />
----<br />
<br />
===X-Control V2 - Digital Signal Processing - NEW!!!===<br />
<br />
These features only will work on devices with NearBus release v0.15 onwards.<br />
<br />
<br />
[[File:x_control_v2.png]]<br />
<br />
<br />
<br />
* '''DIGITAL FILTER:''' The X-Control v2 applies a Second Order Bessel Digital Filter that offers a better performance (noise mitigation and signal smoothing).<br />
<br />
<br />
* '''DIFFERENTIAL PROCCESSING: ''' This module allows you to apply a Differential proccessing over the signal (Inegration and Derivation):<br />
<br />
'''INTEGR:''' The output signal will be the integral of the input signal. (eg: to obtain the Energy [KW/hr] from the instant power [W] measured from a Current transformer)<br />
<br />
'''DERIV:''' The output signal will be the derivative of the input signal.<br />
<br />
'''OFF:''' The module is desactivated (no proccessing is applied to the signal).<br />
<br />
'''RESET:''' Set the initial values to zero (eg: to reset the output when working in Integration mode).<br />
<br />
<br />
<br />
* '''OUTPUT LIMITER: ''' This module when configured will limit the output signal to the set value. This feature is useful when you send data to Xively because its auto-scale feature can be useless when you are experimenting with wide flapping signals (the saturation peaks hide the valid readings). <br />
<br />
'''OFF:''' The module is desactivated (no limitation is applied to the signal).<br />
<br />
'''<value>:''' Here you should set the absolute value to limit the signal (the system limits both positive and negative values). <br />
<br />
<br />
<br />
<br /><br />
----<br />
<br />
===Device Monitor===<br />
<br /><br />
This screen shows you the system data interchange for each device over the following interfaces:<br />
<br />
NearHub <--> Device<br />
<br />
NearApi <--> User App<br />
<br />
<br />
<br />
[[File:screenshot_6.png]]<br />
<br />
<br />
'''AGENT DEBUG:''' (not shown) This option allows you to activate and deactivate the Agent debug output (the terminal output on the Arduino platform).<br />
<br />
<br />
'''Note:''' this feature is intended to be used in troubleshooting and system tuning.<br />
<br />
<br />
'''REMEMBER:''' If you are experimenting random errors with your code (usually on memory exhaustion conditions), verify that the #define parameters DEBUG_DATA, DEBUG_BETA and DEBUG_ERROR (in file NearBusxxx_xxx.cpp) are all set to 0 (in order to deactivate the output debug messages).<br />
<br />
<br />
<br />
----<br />
<br />
===Changing User Configuration===<br />
<br /><br />
In order to change your user configuration (password / email) you should "click" on the user name link in the DEVICES LIST screen, as showen in the following picture:<br />
<br />
<br />
[[File:edit_user_1.png]]<br />
<br />
<br />
<br />
The EDIT USER screen allows you to change your account password and/or your notification email address:<br />
<br />
<br />
[[File:edit_user_2.png]]<br />
<br />
<br />
----<br />
<br />
===REST API - VMCU MODE===<br />
<br /><br />
<br />
For information about the VMCU mode please go to: '''[[NearAPI REST Documentation]]'''<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===REST API - TRANSPARENT MODE===<br />
<br /><br />
Probably the most powerful feature of NearBus system is the Transparent mode working with RTESful. Under this mode the system allows you to exchange up to eight 32 bits registers (int) in each system call.<br />
<br />
<br />
'''The API URL is the following:'''<br />
<br />
http://www.nearbus.net/v1/api_transp<br />
<br />
<br />
This interchange (or synchronization works) as a simple function call that you can do from your Arduino sketch, as a traditional function call.<br />
<br />
There are 2 group of 8 (32 bits) registers each: rxChannel[ ] and txChannel[ ]:<br />
<br />
<br />
The '''rxChannel[ ]''' is used to receive the data from the Cloud and the '''txChannel[ ]''' is used to send the data to the Cloud.<br />
<br />
<br />
As you can see in the following example (to turn on and turn off the Arduino pin 3), there is no change in the way in which the sketch is programmed. The only requirement is to set the '''txChannel[ ]''' registers, then call the Agente.NearChannel() function and finally process the received values in the '''rxChannel[ ]'''.<br />
<br />
<br />
<br />
[[File:screenshot_8.png]]<br />
<br />
<br />
<br />
'''IMPORTANT:''' Remember to configure your NearBus device in "TRSNP" mode (uncheck the VMCU option) in the "EDIT DEVICE" configuration screen.<br />
<br />
<br />
When calling the Agente.NearChannel() function, the data in the txChannel[ ] will be replicated in the NearHub data base Reg A (data from the Agent) and the rxChannel[ ] will be updated with a copy of the data in the NearHub data base Reg B (data to the Agent)<br />
<br />
<br />
From the application point of view the data can be exchanged through the RESTful API calls, in a similar way as was shown in the VMCU mode.<br />
<br />
<br />
The following examples shows the browser's command line (browser's address bar) that should be used to turn on and turn off the Arduino's pin 3 in the last example.<br />
<br />
<br />
'''Turning ON the pin'''<br />
http://nearbus.net/v1/api_transp/NB100xxx?user=****&pass=****&method=POST&reg00=1<br />
<br />
<br />
'''Turning OFF the pin'''<br />
http://nearbus.net/v1/api_transp/NB100xxx?user=****&pass=****&method=POST&reg00=0<br />
<br />
<br />
'''Note:''' In order to simplify the example the unused registers have been avoided (the transp_api supports this syntax). The full example to turn on the pin should be:<br />
<br />
http://nearbus.net/v1/api_transp/NB100xxx?user=****&pass=****&method=POST&reg00=1&reg01=0&reg02=0&reg03=0&reg04=0&reg05=0&reg06=0&reg07=0<br />
<br />
<br />
<br />
----<br />
<br />
If you are interested in trying the NearAPI please contact us at: '''info@nearbus.net'''<br />
<br />
<br />
<br />
(*) This initial trial release has been deployed only for the Arduino Ethernet platform. We are deploying new Agent libraries for other Arduino boards and platforms with Ethernet and Wi-Fi connectivity.</div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Three_simple_steps.png&diff=127File:Three simple steps.png2018-03-29T20:38:09Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Temperature_controller.png&diff=126File:Temperature controller.png2018-03-29T20:37:40Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Edit_user_1.png&diff=125File:Edit user 1.png2018-03-29T20:36:51Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xmas_sequencer_5.png&diff=124File:Xmas sequencer 5.png2018-03-29T20:30:44Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xmas_sequencer_4.png&diff=123File:Xmas sequencer 4.png2018-03-29T20:30:31Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xmas_sequencer_3.jpg&diff=122File:Xmas sequencer 3.jpg2018-03-29T20:30:23Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xmas_sequencer_2.jpg&diff=121File:Xmas sequencer 2.jpg2018-03-29T20:30:15Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xmas_sequencer_1.png&diff=120File:Xmas sequencer 1.png2018-03-29T20:30:03Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xively_power_chart.png&diff=119File:Xively power chart.png2018-03-29T20:29:51Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:Xively_config_power.png&diff=118File:Xively config power.png2018-03-29T20:29:40Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:X_temp_control_3.png&diff=117File:X temp control 3.png2018-03-29T20:29:30Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:X_temp_control_2.png&diff=116File:X temp control 2.png2018-03-29T20:29:22Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:X_temp_control_1.png&diff=115File:X temp control 1.png2018-03-29T20:29:15Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwikihttps://nearbus.xyz/mediawiki/index.php?title=File:X_temp_control_0.png&diff=114File:X temp control 0.png2018-03-29T20:29:07Z<p>Nearwiki: </p>
<hr />
<div></div>Nearwiki