loading

Hi everyone,

me and my friends Habbi95 and mgl1995 have been looking for some ways to measure AC current and controlate a plug throw an application.There are lots of intelligent plugs on the markets that provides you with some functions like turn the power on/off.

This project was for 'Creative Electronics', a Beng Electronics Engineering 4th year module at the University of Málaga, School of Telecommunications (www.etsit.uma.es).

We have done one of this intelligent plugs with the posibility to measure current that it is consuming being able to measure all type of devices that you connected on it.

Different parts from our system:

  • 20 AC/DC relay
  • arduino wifi ESP8266 ESP-12
  • current sensor ACS712
  • Powerstrip
  • pcb
  • male and female pins
  • some resistors (1k,10k,1.5k,5.6k)
  • mobile charger
  • soldering iron and tin
  • 5V/3V converter LD1117
  • BS170 Mosfet transistor
  • USB-TTL converter
  • Modem

Now we're going to show us the different steps of the set up.

Step 1: Measure AC Current With ACS712

This sensor takes advantage of the Hall effect to be able to measure current between its two terminals with a scale of Vcc. This time we are working with 20A model one that has 100mV/A sensibility. We posted an image with the acs712 connection with arduin

Steps to work with this sensor:

  • Measure real values (Offset and sensibility)
    • We connect sensor to 5V and GND.
      • Offset: measure sensor without load.
      • Sensibility: two measurements with two different know currents value and we calculate the sensibility with this fuction: S = (V1 - V2) / (I1 - I2)

The sources where we have extracted the code have been:

DC --> http://www.naylampmechatronics.com/blog/48_tutoria...

AC --> http://henrysbench.capnfatz.com/henrys-bench/ardui...

Step 2: AC/DC Relay

This is a relay that guarantee to support 20A loads (be careful using high currents because the luster terminal only provides you 8A loads) . For one side it has three inputs (Vcc,Gnd,Ctrl) with 5V supply.

Model: SparkFun Beefcake Relay Control Kit https://www.sparkfun.com/products/13815

We need 3.75V VHmin and 0.5V VLmax.

Once we buy it we only need to follow the steps on the next page:

http://tienda.bricogeek.com/kits-electronica-para-...

The diagram for connecting the relay to the arduino is in a image.

You can see the correct operation using digitalWrite(relayPin,LOW/HIGH).

Step 3: ESP8266-12 WIFI

First, we need to know the arduino's module programming using the connection diagram.

TX and RX pins are connect with RX and TX pins from USB-TTL converter. If you want to come to normal mode again you have to disconnect GPIO0 from GND and restart it.

Arduino code is upload in our github.

You need to install some libraries in the Arduino IDE for this module following the steps from the next link:

https://github.com/esp8266/Arduino

Step 4: Node.js Server

Node.js server steps:

Open the terminal and go to the directory using cd command and once you stay there use node server.js to run the server.

To access the server you have to write your IP:3000 (3000 is the port we use) on your browser.

We used an old modem to create an small LAN for manage all easier. Access the router from the browser (192.168.1.1 usually) and go to LAN section (In the images we see the example of use with my router) and search some mapping tab. We select an address out of range or turn off DHCP (not recommended).

Step 5: Powerstrip Changes

We should set up the powerstrip to put on the relay and current sensor (if you have a bigger one, you could include ESP2866 too).

First, you have to move away the switch button (if your powerstrip have one) desoldering wires. We have to do some holes around the powerstrip to fit the relay.

Step 6: Results and Final Steps

Here we added some shots about our wifi PCI with different parts: 5V-3.3V converter, voltage divider made it with two resistors (1.5k and 5.6k) for ESP2866 ADC input (ESP2866 needs 1V) and 3.3V-5V converter for relay input (ESP2866 has 3.3V output), take a look at this link:

http://www.hobbytronics.co.uk/mosfet-voltage-level...

We inserted the PCI into an extern box connected with powerstrip though wome wires (you can see it in the photos we uploaded).

Final code is in our github called ESP2866_Code.

Finally we added a small video with the operation of the complete system. Hope you like it and thank you for visiting our project.

Lovely mates, really impresive <br><br>
Awesome &lt;3
<p>I like it :)</p>
<p>That's neat :)</p>

About This Instructable

1,798views

24favorites

License:

More by juanfraska:iPlug (make your own intelligent plug) 
Add instructable to: