Using SPI + Arduino

Hey everyone,

I’m quite new to the whole Squirrel programming, and I’m trying to send data from the Arduino through SPI to the IMP. I have an Electric Imp shield bought from Sparkfun.

The idea is to have a energy meter using the ADE7763 chip. This part is already done and based on this setup:

http://www.analog.com/static/imported-files/application_notes/an564.pdf

Basically we have an Arduino Uno R3 getting values from the ADE via SPI. My point now is to take those values, send them again through SPI to the Imp and have the server show them in the Planner. I checked the wiki to see how the API works and it seems that the Imp does not have a Chip Select pin, so I can’t probably use the Imp as a value reader when I have other peripherals.

I wanted to know if I’m thinking straight or if it is in fact possible to have the Arduino reading from the ADE and sending the data to the Imp. I could try to replace the Arduino with just the Imp shield, but migrating the code would be a lot of trouble. Another way of doing it is possibly have the Arduino send the values through a regular I/O pin (but then it limits me to the values I can send).

All help is welcome. Cheers!

Why not send your data through the UART? That is already wired up on the sparkfun shield but you do have to cut? or solder the correct jumper depending which pins you wish to use for the UART.

I’m going to try and migrate the code (http://fll-freak.com/blog/wp-content/uploads/2012/04/PowerMeter.zip) using this example:

http://pastebin.com/4v5ntaK2

Still, not sure if it will work right

If you’d used a 7953 (i2c interface) then I could have given you the becky code ( http://devwiki.electricimp.com/doku.php?id=becky ) which just talks to the power monitor chip directly from the imp…

Is there any reason you’re using the arduino in the middle? The imp can talk SPI to the 7763 too, which will definitely be simpler.

I’m just using the 7763 and the arduino because I already had the code for the arduino, so I figured I could easily send the info to the Imp.

My ultimate goal is to use only the Imp Shield+7763, but I’m having trouble getting started, never did any SPI communications before, so I’m not really sure how to access the registers and get proper values from the 7763. I even think that the .ino that I have is also messed up, so it is hard doing any sort of debug in my SPI communication to the Imp.

If you could send me the becky code I’d really appreciate it. It shouldn’t have too many differences using the 7763 (apart from the i2c), however I’m actually considering ordering the components to make the smartplug like you guys did.

Thanks for all the replies!

I have a 7763 here so may take a look at this when I have time, maybe at the weekend…

Since you already have the schematics and bill of materials for the becky smartplug, I’m much more confident of using de 7953 than the 7763, specially because we weren’t getting any results with this last one.

Could you send me the becky code to look at it while I’m waiting for the components please? And do you have the eagle files (or any PCB schematic)? Thank you very much for the help

Just added the code to the becky page on the devwiki. Let me know if you have any questions.

Gonna look at the code in the morning, but thanks a lot for the trouble!