Showing posts with label Relay. Show all posts
Showing posts with label Relay. Show all posts

Saturday, November 5, 2016

WIFI Dev Board for Home Automation - Part 2



This is Part 2 of the Wifi Dev Board for Home Automation series. For general presentation and hardware description please take a look also at Part 1 of the series


MPRSx8 Board is available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/







What we will need:



Software implementation:

As this time we will talk about the Software side we will design a very simple driver for our board that will include also a interactive Web command interface for the MPRSx8 Home Automation Dev Board Relays.

To keep things simple, we will just add in our Web Interface 8 ON/OFF Buttons and one general OFF one, from where we can turn ON/OFF all the Relays switches. 


1. Main Program
cls                       ' clear interface
let address = 56  'PCF8574 I2C Address

i2c.setup(4,5)      'choose your I2C bus pins

i2c.begin(address)
ss = 0 xor 255      'XOR - Bit masking for the desired I/O pins
i2c.write(ss)
i2c.end()
button "x1", [5]    ' Button for Relay 1
button "x2", [6]
button "x3", [7]
button "x4", [8]
button "x5", [1]
button "x6", [2]
button "x7", [3]
button "x8", [4]    ' Button for Relay 8
button "OFF", [9] ' General OFF for all the Relays
wait


2. General OFF for all the Relays subroutine
[9]
i2c.begin(address)
ss = 0 xor 255 'XOR - Bit masking for the desired I/O pins
i2c.write(ss)
i2c.end()
wait


3. Subroutines for each Button
[1]
i2c.begin(address)
ss = ss xor 1   'XOR - Bit masking for the desired I/O pins
i2c.write(ss)
i2c.end()
wait

[2]
i2c.begin(address)
ss = ss xor 2
i2c.write(ss)
i2c.end()
wait

[3]
i2c.begin(address)
ss = ss xor 4
i2c.write(ss)
i2c.end()
wait

[4]
i2c.begin(address)
ss = ss xor 8
i2c.write(ss)
i2c.end()
wait

[5]
i2c.begin(address)
ss = ss xor 16
i2c.write(ss)
i2c.end()
wait

[6]
i2c.begin(address)
ss = ss xor 32
i2c.write(ss)
i2c.end()
wait

[7]
i2c.begin(address)
ss = ss xor 64
i2c.write(ss)
i2c.end()
wait

[8]
i2c.begin(address)
ss = ss xor 128
i2c.write(ss)
i2c.end()
wait


In the Web editor interface Save your program as "test_MPRSx8_1.bas" and Run it.



If all OK the result should look as below:




If you want your program to start automatically at reboot/power ON then just Save it as "default.bas" and also from Settings Tab enable the "Run default.bas at startup".



Be aware that at start-up/reboot, it is a delay before your program will start automatically.




WIFI MAINS 8x Relay Board for Home Automation and more


Available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/








Features:
  • Compact, standard size: 16x5 cm! (half Eurocard height)
  • Universal AC MAINS input (240VAC/50Hz (EU) or 110V/60Hz (US)
  • Proper MOV and high quality ceramic FUSE MAINS input protection.
  • 8 x MAINS rated 15A Relays
  • 8 x independent swithing Power Channels 
  • Power Channels can be software configured for mutually exclusive usage
  • Recommended load upto 10A each channel
  • LED signaling Panel for each Power Channel Status 
  • Integrated switchmode MAINS PSU
  • Separate high efficient switchmode PSU for command & control circuit
  • Can work also from a external +12V power supply just not install the MAINS PSU
  • Safe operation design
  • I2C / nEXT Bus compatible - you can add your own extension modules - light sensors, gas, motion, etc
  • Can be stacked upto 8 boards ( 1 Master and 7 slaves) for a total of 64 Power Channels!!
  • Compatible with any I2C compatible MCU: Arduino, ARM, PIC, ATMEGA, ESP8266, ESP32, etc
  • ESP8266 friendly design: can add your ESP8266 module directly onboard for a full WIFI MAINS Power switchboard solution
  • Full access to ESP8266 pins thru 2 headers gives you even more flexibility in developing your projects!
  • Full programming header  (Tx, Rx, GPIO0 and Reset)

Command and control side - pinout details




 Schematics:


MAINS input power supply



3.3V power supply for the command and control section



Relays driver


In Part 2 we will continue with the software side, how to connect, program and use the MPRSx8 Relay board.






Creative Commons License All schematics, boards, software and articles released by ESP8266-Projects.com are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 








Tuesday, March 10, 2015

Mailbag arrival! New ESP Modules in Town :)


 Just a quick one about new goodies found in the MailBox :

External protective envelope

   Envelope in Bulgarian language:)

   Have you ever heard about Bulgaria? Is a country in southeastern Europe, member of the European Union, NATO, and the Council of Europe.

   And why are we interested about?

   It's a lovely Country, nice seaside, nice and friendly people and I can give you another MAJOR reason:

Plovdiv - the second largest city in Bulgaria, is home of OLIMEX LTD, a leading provider for development tools and programmers for embedded market, a well knows company with over 20 years experience in designing, prototyping and manufacturing printed circuit boards, sub-assemblies, and complete electronic products.

   Ok, ok, enough with geography lessons let's see what's inside :)

Products individual cardboard packaging boxes


Inside the boxes - 1

   YES, indeed, they are ESP8266 Modules :). They look promising and first of all they are Open Source Hardware! You can find all the related documents, schematics and software examples on OLIMEX website.


1. MOD-WIFI-ESP8266 Module

MOD-WIFI-ESP8266 - TOP

MOD-WIFI-ESP8266 - Bottom

2. MOD-WIFI-ESP8266-DEV Module

MOD-WIFI-ESP8266-DEV - TOP
MOD-WIFI-ESP8266-DEV - Bottom

   If you are interested how it looks compared with the corresponding cheap Chinese Module sold on Ebay and arround, take a look below:

TOP

BOTTOM


     I don't know how much can be seen in the pictures above but is quite a big difference in the quality of the products. And if you remember the ESP-07 Module DOA story  might worth to think about spending a few bucks more on a proper tested product from a trustable source. Chinese NO-NAME one is around 4$ on Ebay, Olimex one about 5.50.

     I, personally, think that is good to have also other options and sources than the Far-East Factories. And not only for ESP Modules. Putting all the Global eggs in one basket might become a nasty story sometime...


3. ESP8266-EVB Board

    ESP8266-EVB is the companion Evaluation board for MOD-WIFI-ESP8266-DEV with relay, button, UEXT, all GPIOs available on standard 0.1" header. Breadboard friendly! 


ESP8266-EVB - TOP


ESP8266-EVB - Bottom

   
                That's all for Mailbag today and be sure we will put them at work soon !!