Driving High voltage loads with optoisolated 220VAC/16A switch by Arduino and OLinuXino

eduArdu is educational low cost Arduino board, it has plenty of resources like: LED 8×8 display, Joystick, Buzzer, Microphone, temperature sensor, Ultrasound distance meter, PIR sensor, IR emitter and receiver, Capacitive buttons, RGB LED, Lipo charger for stand alone work.

Here we will show you how you can drive high voltage loads like lamps, heaters etc with PWR-SWITCH connected to eduArdu.

Plug PWR-SWITCH in mains and the object you want to control plug in PWR-SWITCH receptacle.

Then connect “-” termianl of PWR-SWITCH input to eduArdu UEXT.pin2 and “+” terminal of PWR-SWITCH input to eduArdu UEXT.pin4.

In Arduino IDE make this program:

void setup() {
   pinMode(0, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
   digitalWrite(0, HIGH); // turn the PWR-SWITCH on
   delay(5000); // wait for a 5 seconds
   digitalWrite(0, LOW); // turn the PWR-SWITCH on
   delay(5000); // wait for a 5 seconds
}

The Lamp will start to blink 5 seconds on and 5 seconds off.

You can drive high voltage loads with A20-OLinuXino-LIME2 + LIME2-SHIELD:

In this setup connect “-” termianl of PWR-SWITCH input to LIME2-SHIELD GPIO.pin9 and “+” terminal of PWR-SWITCH input to LIME2-SHIELD GPIO.pin7 (GPIO271 in Linux) and you can use this code to switch on and off PWR-SWITCH:

echo 271 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio271/direction

echo 1 > /sys/class/gpio/gpio271/value

echo 0 > /sys/class/gpio/gpio271/value

or you can use Python and pyA20LIME2:

!/usr/bin/env python
from pyA20Lime2.gpio import gpio
from pyA20Lime2.gpio import port
from pyA20Lime2.gpio import connector
gpio.init() #Initialize module. Always called first
gpio.setcfg(port.PI15, gpio.OUTPUT)

gpio.output(port.PI15, gpio.HIGH)
gpio.output(port.PI15, gpio.LOW)

15 New Products in stock

Image

We have 15 new products in stock! Above on the picture you see KBD-BT1 which is 3-in-1 Wireless Keyboards + Touch panel mouse + Laser pointer. This keyboard works with all our OLinuXino boards both under Android and Linux and have re-chargeble LiPo battery which can be charged on any USB port or adapter with USB mini cable.

KBD-BT2 is bigger version, gamer edition, with bigger LiPo battery, many functiona keys:

Image

again it’s compatible with any OLinuXino both under Android and Linux, but you can use it with any Android dongle or your smart TV to browse internet and work from distance.

USB-BT4 is super duper mother of all Bluetooth dongles. It supports Classic Bluetooth 2.0, High speed Bluetooth 3.0 and latest Bluetooth Low Energy 4.0, so you can use it with nRF8001 and any other Bluetooth device which is 2-3-4 compatible. The dongle comes with mini CD for WIndows installation. Linux distributions with kernel 3.11 or higher should have implementer BLE 4.0 support, for the moment support for OLinuXino is not available as our kernel is 3.4, but we hope to have support soon:

Image

 

We got two new ECG electrodes. ECG-SCUP is suction cup electrode compatible with SHIELD-EKG-EMG when used with SHIELD-EKG-EMG-PRO cable and snaps directly to it:

Image

ECG-CLIP is clip electrode compatible with SHIELD-EKG-EMG when used with SHIELD-EKG-EMG-PRO cable and snaps directly to it:

Image

AOY-T1-6DAOY-T-I and AOY-T-B are soldering iron tips for AOY-SLD936 and AOY-SLD936A soldering stations:

ImageImageImage

AOY-B002 is 60W/24V spare handle with ceramic heater and soldering tip for AOY-SLD936A

Image

AOY-B004 is 35W/24V spare handle with ceramic heater and soldering tip for AOY-SLD936

Image

AOY-C001AOY-C008 and AOY-C010 are spare ceramic heaters for AOY-SLD936, AOY-936A and AOY-SLD463 soldering stations:

Image

 

CHN-TWZ2MM is lower cost but still good quality tweezers alternative to PGC-00SA professional tweezers:

Image

 

CHN-TWZ1MM is ultra low cost amateur quality tweezers which are good for pick and place of SMT components but can’t be used for component lead forming like CHN-TWZ2MM and PGC-00SA.

Image

 

Measuring temperature in range -55C +150C with Duinomite and KTY81,110

ImageKTY81,110 is low cost PTC thermistor from NXP. it changes the resistance dependant on the temperature positively i.e. increase with the temperature increase. It’s very nice solution for not so precisely temperature measurement and it’s very cheap.

I evaluate it as potential candidate for Solar Water Heating controller temperature sensor as it works in nice teperature range -55C to +150C.

The NXP datasheet for KTY181,110 is at NXP site as you can see there is table with approximate values at different temperature, the resistance / temperature is not linear but can be easily calculated with DuinoMite.

To measure the temperatuere we connect KTY181.110 in series with 3300 ohm resistor to +3.3V and will measure the temperature with PIN(1) analog input.

Here is the table with the temperature, KTY81.110 resistance and measured voltage

t R V
———————–
-55 490 0.42665
-50 515 0.44548
-40 567 0.48386
-30 624 0.52477
-20 684 0.56657
-10 747 0.60912
0 815 0.65358
+10 886 0.69847
+20 961 0.74426
+25 1000 0.76744
+30 1040 0.79078
+40 1122 0.83731
+50 1209 0.88483
+60 1299 0.93209
+70 1392 0.97903
+80 1490 1.02651
+90 1591 1.07346
+100 1696 1.12026
+110 1805 1.16680
+120 1915 1.21179
+125 1970 1.23359
+130 2023 1.25416
+140 2124 1.29226
+150 2211 1.32395

the code is pretty simple, we store the table in DATA and read it to T() and V() arrays which hold the temperature and voltage at the reference points

5 OPTION BASE 0
10 DATA -55,0.42665,-50,0.44548,-40,0.48386,-30,0.52477,-20,0.56657,-10,0.60912,0,0.65358,+10,0.69847
20 DATA +20,0.74426,+25,0.76744,+30,0.79078,+40,0.83731,+50,0.88483,+60,0.93209,+70,0.97903,+80,1.02651
30 DATA +90,1.07346,+100,1.12026,+110,1.16680,+120,1.21179,+125,1.23359,+130,1.25416,+140,1.29226,+150,1.32395
40 DIM T(23),V(23)
50 FOR I = 0 TO 23: READ T(I): READ V(I): NEXT I

then we setup PIN(1) as analog input:

60 SETPIN 1,1

as the temperature is read pretty fast and we don’t need so fast measurement we read the temperature 1000 times then average it for better precision 😉

70 NRD = 1000 ‘number of times to read
100 ‘read temperature
110 VOL = 0
120 FOR I = 1 TO NRD: VOL = VOL + PIN(1): NEXT I: VOL = VOL / NRD

then check if the voltage is in the range we expect i.e. -55 +150C and if not generate error

130 IF VOL < V(0) OR VOL > V(23) THEN 180

then we search in the table for near higher temperature reference point

140 I = 0
150 DO
160 IF VOL > V(I) THEN I = I + 1 ELSE GOTO 200
170 UNTIL (I=23)
180 PRINT “ALARM – TEMPERATURE OUTSIDE -55+150C”

then calculate exact temperature

200 TEMP = T(I)-(V(I)-VOL)*(T(I)-T(I-1))/(V(I)-V(I-1))
210 PRINT “TEMPERATURE IS:”; TEMP
220 GOTO 100

here you can see screenshot of the program running in my office

Image