Unfortunately, the Raspberry PI board does not have an analog to digital converter, so you can use no analogue sensor (which is a pity, btw).
Fortunately, Robofun.EU has you covered. The Sensor Shield V4 for Raspberry Pi allows you to connect any analogue sensor platform Raspberry Pi and thus expand its capabilities.
For example, one can measure acceleration using the ADXL335, or you can measure the level of alcohol in the breath using a sensor MQ3 (or gas concentrations LPG, methane, or carbon monoxide), bending or pressing force, distance with Sharp or ultrasonic sensors, light levels in the room temperature or humidity level, or can detect sound (to name just some of the applications).
Connecting shield’s platform Raspberry Pi is simple. Just check the below diagram.
Raspberry Pi Model B V3 + Sensor Brick for Raspberry Pi + Sensor Brick Temperature
The VCC pin is connected to the terminal VCC 5V sensor Raspberry Pi.
GND pin is connected to the terminal GND sensor Raspberry Pi.
OUT pin sensor connects to a sensor input on Brick Sensor.
This example works with a wide range of analog sensors, not just temperature sensor.
Before running the source code needed to enable SPI module (GPIO ports extension) and install Python development environment on Raspberry Pi.
The steps are:
1. Sign SSH module board and see if the SPI port is visible or not.
2. If the module SPI port is not visible in the configuration it is necessary to activate it.
$ Sudo rasp-config
3. To activate the SPI is necessary to follow the instructions below:
4. After reboot check if SPI port module is visible.
5. Next we will install the git and python-dev package:
$ Sudo apt-get install git-core
$ Sudo apt-get install python-dev
6. Now you download package py-spidev and it compile it:
$ Cd / home
7. Check your operating system version:
$ uname -r
If output is greater than 3.15 then execute the following command:
$ Sudo git clone git: //github.com/Gadgetoid/py-spidev
Otherwise execute the command:
$ Sudo git clone git: //github.com/doceme/py-spidev
8. Install package py-spidev:
$ Cd py-spidev /
$ Sudo python setup.py install
9. Create a file called analog.py and copy the code below to copy paste.
$ nano ./analog.py import spidev import time spi = spidev.SpiDev() spi.open(0,0) def readadc(adcnum): if ((adcnum > 7) or (adcnum < 0)): return -1 r = spi.xfer2([1,(8+adcnum)<<4,0]) adcout = ((r&3) << 8) + r return adcout while True: for adcInput in range(0,8): value = readadc(adcInput) print "---------------------------" print "ADC(", adcInput,")= ", value print "---------------------------" time.sleep(1)
10. Run the program.
$ Sudo python analog.py
You will see a range of values runs. These are the successive values read from your analog sensor.
Returns and Exchanges
There are a few important things to keep in mind when returning a product you purchased.You can return unwanted items by post within 7 working days of receipt of your goods.
- You have 14 calendar days to return an item from the date you received it.
- Only items that have been purchased directly from Us.
- Please ensure that the item you are returning is repackaged with all elements.
Ship your item back to Us
Firstly Print and return this Returns Form to:
30 South Park Avenue, San Francisco, CA 94108, USA
Please remember to ensure that the item you are returning is repackaged with all elements.
For more information, view our full Returns and Exchanges information.