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
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
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.
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.
Step 3: Coding the Imp
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
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
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
1 USB to Arduino Cable