Introduction: Safe Outlet

We all know that kids like to discover all things around them. and we need to keep them safe from hazard when they try to insert any thing in the electric outlet.

in this instructable we will make the outlet tweet us when anything inserted it it

Step 1: What We Need?

  • Spark Core
  • Electric Plug
  • Micro Limit Switch
  • Soldering iron
  • Twitter account

Step 2: Prepare the Socket

  • Disassembling the outlet to find plastic part that used to close the socket if no plug inserted
  • we will put the limit switch on the side so it can be triggered if the plug inserted
  • use a cutting tool wisely to make a space for the limit switch
  • insert an electric plug so you can adjust the limit switch easily
  • Use a multimeter to test that everything works fine when you insert the plug
  • attach the limit switch to D1 input on SparkCore

Step 3: Setting Up Twitter

We're going to use PushingBox to handle the tweeting. So go to www.pushingbox.com and click the Login with Google button at the right top.
Then click the My Services button in the menu at the top. Click Add a service, choose Twitter, and follow the instructions.

Next click My Scenarios in the menu at the top. Type a name for your scenario in the input field. I called my scenario "outlet_state".

After you pushed the Add button, it will automatically open the page of your scenario. On this page we're going to define the Tweet. Click the Add an Action button and then choose Twitter. Type your Tweet in the pop-up.

Step 4: The Code

You only have to change a tiny thing in the code "DeviceID". When you look at the code, you will see DEVICE_ID1 on line 13. You need to change those to the DeviceID of your scenario. After you've done that you can flash the code to your Spark Core.

Step 5: Final

Now you have a safe electric outlet that tweets you when your kids insert any thing into it.

for more safety you can tweet the Spark Core to activate a connected relay to the outlet to let that electricity flow in it ( but this will be another tutorial )

you can flow these tutorials to know how to send and read from Twitter

Spark Core Send-a-Tweet (spark.io)

Spark Core Read-a-Tweet (spark.io)