Simplified Electric Imp to Arduino Due Tutorial

Introduction:
This is a basic tutorial to send information from the Electric Imp to the Arduino Due through UART (RX, TX) I am pretty new to both so some things I write may be incorrect. Most of the information I got from

Electric Imp to the Arduino

https://www.sparkfun.com/tutorials/397

If you know how to program well that tutorial may be way better then this one, but I thought this would be a more basic and easier tutorial for people to use.

Step 1: Connect Everything Up

First you have to solder the headers into the electric imp shield, to power it you need to have 5V and GND connected from the Arduino Due to the Electric Imp Shield so these are really the only ones you have to solder but its better to do at least a row as you can see in the pictures.
You then need to place the Electric Imp card into the shield. I’m Assuming if everything is commissioned already this part is probably all already done.

Step 2: Actually Connecting the Arduino Due with the Electric Imp

Since this is the Arduino Due, you unfortunately can’t use software serial library as far as I am aware, due to this you have to use the hardware serials on the Arduino and the Software on the electric imp.

It’s important to look at the schematic of the Arduino Shield for the imp
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/electric-imp-shield-v11.pdf
Hosted by SparkFun https://www.sparkfun.com/products/11401

On here you can see that for the UART the RX and TX for software is on holes 8 and 9 of the arduino shield.
8->Tx
9->Rx
So we will connect a cable from each of this to the hardware UART Rx and Tx of the Arduino Due. I use RX1 (input 18) and Tx1 (input 19) but note that the Rx of the Imp Shield connects to the Tx of the Arduino Due, and the Tx of the imp shield connects to the Rx of the Arudino Due.
That way you can transfer with the shield and read with the arduino, or read with the shield and transfer with the arduino.

Electric Imp to the Arduino connection

Step 3: Coding the Imp

With the Electric Imp connected, go onto your imp account and create a new code under the code tab. and name it however you like. The code will be pretty simple and just output “hello world” to the Arduino then it will wait 5 seconds and repeat again.

This details can all be obtained from http://devwiki.electricimp.com/doku.php?id=example:uart which explains it really well but I will go through my code still.
First we configure the pins as follows, if you remember from the schematic before uart57 connects to pins 8 and 9 of the software serial of the imp shield. A baud rate of 19200 is used for both the shield and the arduino that we used before. 8 Bits are sent and no parity bit.
hardware.uart57.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS);

We then create the function that writes “hello world” to the UART using the hardware.write

function write()
{
imp.wakeup(5.0, write);
hardware.uart57.write(“hello world”);
}

I then call this function every 5 seconds, you can change this time but it just seems like around a nice time to see it work easily
imp.wakeup(5.0, write);

After that, thats it, press the save and run button on the Electric Imp online code, and make sure you change it in the planner tab to make sure the code you just made is the one that is running.

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]Things You Need:
Electric Imp Shield
Commissioned Electric Imp (http://devwiki.electricimp.com/doku.php?id=commissioning)
Electric Imp Account
Arduino Due
1 USB to Arduino Cable
2 Wires
2 Headers[/box]


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top