ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 10:39 am

Hi folks,

I'm fairly new to all this and don't yet have a good understanding of GPIO or wiring in general (e.g. how do you even use a breadboard?).

I've just bought two of the new Astro Pi units and want to get both of them plugged into a single Raspberry Pi 2 Model B unit.

I realise one Astro Pi takes up all the GPIO pins on the Pi. Is there a way to connect them both to a breadboard and then plug the breadboard into the Pi?

If so, can you please point me in the direction of any appropriate guides for total noobs?

(Side note for those wondering: I want to get the x-, y-, and z-axis magnetic field data from both Astro Pi units, and average them in order to create a magnetic gradiometer.)


Thanks in advance for any help provided. :)
Dave


P.S.: I currently have the following parts which may be of use...:
1. A t-cobbler with 40-pin ribbon cable to suit my RPi 2.
2. A breadboard.
3. A classical assortment of male-to-male and female-to-female jumper leads.

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 10:46 am

the AstroPi aren't designed to be connected in multiples, workarounds are possible but I would suggest one AstroPi and one seperate i2c magnetometer breakout board (or 2 off magnetometer breakoutboards).

Trying to get two HATs working together on one Pi may be difficult. the AstroPi's magnetometer is probably connected by i2c so two boards would have the same i2c address on each of them (and changing the address might be difficult).
Doug.
Building Management Systems Engineer.

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 10:53 am

Breakout boards featuring the LSM9DS1 (same chip as used in the AstroPi) are quite expensive, there are cheaper magnetometer only breakout boards available.
Doug.
Building Management Systems Engineer.

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 12:16 pm

Thanks for that advice, Doug.

I was originally looking at using this magnetometer: http://www.altronics.com.au/p/z6300-3-a ... or-module/

...but the instructions and wiring are for an Arduino, and I've got no idea what I'm even looking at. The reason for using this mag is that it has a much greater resolution (15nT) than anything else I could find in the <$100 range.

There is a wiring diagram and code example over at http://wiring.org.co/learning/basics/magneticfield.html but I've got no idea what any of it means. Are you able to decipher where I should plug the wires in based on the wiring diagram there?

And would the code given there work on a Pi or would I need to translate it into Pi-code?

Thanks again for your help; I appreciate it.
Dave

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 12:52 pm

Actually, I think I have figured out the wiring. I found the product's data sheet which describes the operation of the sensor and from that I could figure it out. :D

Thanks again for your help, Doug.

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 1:14 pm

ZPMMaker wrote:Actually, I think I have figured out the wiring. I found the product's data sheet which describes the operation of the sensor and from that I could figure it out. :D

Thanks again for your help, Doug.
You are welcome.

That sensor works by SPI, you would connect the Pi's CLK (pin23) to the SCLK of both sensors, the Pi's MISO (pin21) to the MISO of both of the sensors and the Pi's MOSI (pin19) to the MOSI of both sensors. connect CE0 (pin24) to the SSNOT one sensor and CE1 (pin26) to the SSNOT of the other sensor.

Image
Image
Doug.
Building Management Systems Engineer.

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Breadboards, Astro Pi, and GPIO input

Tue Sep 01, 2015 1:23 pm

As far as reading from the sensors is concerned, that would depend on which language you wish to program in and how you plan to use the sensor readings generated.
Doug.
Building Management Systems Engineer.

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Breadboards, Astro Pi, and GPIO input

Mon Sep 07, 2015 1:55 am

Hi Doug,

Thanks very much for those last few comments which I only just saw today - apologies for the slow response.

I'll give your advice a try in a few weeks when my work quietens down and I can get back into doing this.

That said, I received a SenseHAT/Astro Pi in the mail the other day, and have got it set up ok.

I'm currently running the default Python script from the Raspberry Pi website:

Code: Select all

#!/usr/bin/python
from sense_hat import SenseHat

sense = SenseHat()
raw = sense.get_compass_raw()
print("x: {x}, y: {y}, z: {z}".format(**raw))
#alternatives
print(sense.compass_raw)
When I run that, I get the following output:

Code: Select all

x: -10.2209234238, y: -7.27446603775, z: -27.6348018646
{'y': -13.094038963317871, 'x': -18.397661209106445, 'z': -49.74264144897461}
Do you know which is the correct set of readings? They are quite different...

Thanks again for your help.
Dave

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Breadboards, Astro Pi, and GPIO input

Wed Sep 09, 2015 10:14 am

FYI, I have contacted element 14, the manufacturers of the Sense Hat (Astro Pi) and we are troubleshooting the issue; they don't know why it's doing this yet. I will keep the forum updated when/if anything significant comes of our troubleshooting.

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Breadboards, Astro Pi, and GPIO input

Thu Oct 15, 2015 5:50 am

ZPMMaker wrote:FYI, I have contacted element 14, the manufacturers of the Sense Hat (Astro Pi) and we are troubleshooting the issue; they don't know why it's doing this yet. I will keep the forum updated when/if anything significant comes of our troubleshooting.
For anyone wondering, the magnetometer itself needs to go through a calibration procedure. element 14's technical support staff were able to advise me that it needed to be done, but couldn't advise me how. :roll:

tl;dr: I'm giving up and am trying with an Arduino and an Arduino-specific magnetometer instead.

Return to “Advanced users”