loading

Greetings! Welcome to another Instructable from NextFab. In this Instructable we will be switching gears a little bit and doing an Instructable that's much more fundamentals based that anyone can pick up then expand upon.

The Raspberry Pi 2 B is a pretty impressive little computer for $35. It has a quad core processor that runs at 900 MHz and has1 GB of RAM which equates to a nice little processing punch in a small package. That's why when given the chance we couldn't think of a better way to take advantage of that processing power than hooking it up and pulling data from a Particle (formerly spark) micro-controller.

Particle is a wifi capable micro-controller that makes sending, receiving, and logging data very easy. With the new Particle Photon in the hands of makers, we thought this would be a nice opportunity to revisit the platform. Unfortunately our Photons were still in the mail at the time of this writing so we went with the Spark Core (see our SparkCore Instructable here!) but it was more than enough for this Instructable. We connected it to an accelerometer and used the RasPi 2 to get the data from the API we set up using the sparkCore. With this data we could then, if we choose to, log it on the RasPi and do some neat things with Processing or Wolfram track it with a touchscreen interface, or even use it as the start of a much larger controls system. So sit back and enjoy this quick exercise we worked out for your education and enjoyment.

Step 1: Circuit and Particle Source Code

We attached the accelerometer to the spark core on a separate breadboard and connected the following wires

xOut - A0
yOut - A1
zOut - A2

GND - GND
3Vo - 3V3 (as reference voltage)
Vin- 3V3*

We then plugged it in and wrote the code (attached) to send the data to an online source by using the spark variable, simple as that. This code can be used in multiple ways with multiple sensors, just update and make the appropriate changes. More on using Particle's cloud API services here. Now onto the Pi and Python part.

<p>File &quot;partPi.py&quot;, line 23, in xAxis</p><p> x_accelParse = (parsed_json[&quot;result&quot;]) #print parsed json</p><p>KeyError: 'result'</p><p>any help will be appreaciated</p>
<p>any idea why am i getting a key error in my code</p>

About This Instructable

6,035views

37favorites

License:

Bio: Collaborative workspace with digital and traditional fabrication tools, 3D printers, CNC machines, classes, events, and professional consulting services.
More by NextFab:3D Metal Flowers Processing Data with RasPi and Particle (formerly Spark) PiHub 
Add instructable to: