Dust Sensor & Barometer Examples

Hi @lokeshpakal,

The name of the example for High Accuracy HP206C barometer sensor is high_accuracy_barometer_example.py and it can be found here.

Please let us know if this works for you,
-Shoban

Hi @Shoban,

While I am running high_accuracy_barometer.py, I am getting the error shown in the picture. I have connected the barometric sensor to I2C-1. Please help.

Hi @lokeshpakal,

Can you post a picture of your setup showing the connections of the sensor with the GrovePi. Can you also follow this guide, generate a test log and post it with your reply.

-Shoban

Hi @Shoban,

This is the picture of my setup. I am adding the test log file from another account as I was not able to copy and paste the file from my raspberry pi to local OS.

Hi @Shoban,

Here is the test log,

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 3.6G 2.9G 498M 86% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 6.2M 425M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 21M 40M 35% /boot
tmpfs 87M 0 87M 0% /run/user/1000

Check for dependencies

python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u2 install ok installed
libi2c-dev 3.1.1+svn-2 install ok installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.2~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
arduino 2:1.0.5+dfsg2-4 install ok installed
minicom 2.7-1 install ok installed
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.32
Copyright Β© 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Sony

  • Device tree is enabled.
  • This Raspberry Pi supports user-level GPIO access.
    -> See the man-page for more details
    -> ie. export WIRINGPI_GPIOMEM=1

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 5: Dev 4, If 0, Class=Vendor Specific Class, Driver=rtl8192cu, 480M

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright Β© 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright Β© 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0' or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version and CPU Speed and Voltage

v -1
CPU speed: -1
-1 V

CHECKING ENCODER READINGS
-1 -1
Both motors moving Forward with LED On
after 5 sec -1 -1
Both motors stopped with LED Off
-1 after stop cmd -1 -1
-1 after 2 more sec -1 -1
Both motors moving back with LED On
after 5 sec -1 -1
Both motors stopped with LED Off
-1 after stop cmd -1 -1
-1 after 2 more sec -1 -1

CHECKING ENCODER TARGETING

Initial encoder read vals: -1 -1
Traceback (most recent call last):
File β€œ/home/pi/Desktop/GoPiGo/Software/Python/tests/enc_tgt_test.py”, line 69, in
enc_stat=read_enc_status()
File β€œbuild/bdist.linux-armv7l/egg/gopigo.py”, line 525, in read_enc_status
File β€œbuild/bdist.linux-armv7l/egg/gopigo.py”, line 517, in read_status
IOError: [Errno 5] Input/output error

Hi @lokeshpakal,

Can you disconnect the sensors and also the ribbon cable connected to the Pi and run the troubleshooting script again and post the log with your reply.

It also looks like no LED is turned ON on the GrovePi, is the picture taken when the GrovePi is powered on?

Can you also send us a picture from the other side so that we can see how the GrovePi header is connected to the Pi.

-Shoban

Hi @Shoban,

The LED was turned on when I took the picture earlier. Now I have disconnected all the sensors and the ribbon and did the troubleshoot. Here is how the pictures look like.

This is the log file which I obtained after troubleshooting by disconnecting the sensors and the ribbon cable. The LED was blinking at that time too. Please help as I am not able to move on.

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 3.6G 2.9G 463M 87% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 6.1M 425M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 21M 40M 35% /boot
tmpfs 87M 0 87M 0% /run/user/1000

Check for dependencies

python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u2 install ok installed
libi2c-dev 3.1.1+svn-2 install ok installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.2~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
arduino 2:1.0.5+dfsg2-4 install ok installed
minicom 2.7-1 install ok installed
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.32
Copyright Β© 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Sony

  • Device tree is enabled.
  • This Raspberry Pi supports user-level GPIO access.
    -> See the man-page for more details
    -> ie. export WIRINGPI_GPIOMEM=1

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 5: Dev 4, If 0, Class=Vendor Specific Class, Driver=rtl8192cu, 480M

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright Β© 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright Β© 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0' or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version and CPU Speed and Voltage

v -1
CPU speed: -1
-1 V

CHECKING ENCODER READINGS
-1 -1
Both motors moving Forward with LED On
after 5 sec -1 -1
Both motors stopped with LED Off
-1 after stop cmd -1 -1
-1 after 2 more sec -1 -1
Both motors moving back with LED On
after 5 sec -1 -1
Both motors stopped with LED Off
-1 after stop cmd -1 -1
-1 after 2 more sec -1 -1

CHECKING ENCODER TARGETING

Initial encoder read vals: -1 -1
Traceback (most recent call last):
File β€œ/home/pi/Desktop/GoPiGo/Software/Python/tests/enc_tgt_test.py”, line 69, in
enc_stat=read_enc_status()
File β€œbuild/bdist.linux-armv7l/egg/gopigo.py”, line 525, in read_enc_status
File β€œbuild/bdist.linux-armv7l/egg/gopigo.py”, line 517, in read_status
IOError: [Errno 5] Input/output error

Hi @lokeshpakal,

Thanks for your patience, it looks like your avrdude is responding now, so can you do a firmware update following the steps 3 to 5 here.

After the firmware update try out an example from here for which you have the sensor and then do the following.

  • Run the command i2cdetect -y 1 and send us a screenshot of the result.

  • Then add your High accuracy HP206C barometer sensor to one of the i2c ports and then run the example high_accuracy_barometer_example.py from here.

  • After which again run the command i2cdetect -y 1 and send us a screenshot of the result.

-Shoban

Hi @Shoban,

It seems there is a problem with updating the firmware. I used the following link to update the firmware.
Here is the link:

I did step-2 and got the following results in the picture. Should I proceed with step-3 to 5?

Hi @lokeshpakal,

I don’t think it would be a problem, actual firmware update is done by steps 3 to 5, you should proceed with it.

-Shoban

While I am running step-3, I am getting this. It says AVR device is not responding.

Hi @Shoban,

This is what I am getting when running step-3 and 4. Please check the above image and guide me.
Thanks.

Hi @lokeshpakal,

Sorry for the frustration, Have you made sure nothing is connected to GrovePi?
Can you tell us what all are connected to the GrovePi when you run the firmware update and also how you are powering the GrovePi. Can you also tell us from where you bought the GrovePi board.

-Shoban

Hi @Shoban,

Yes its a bit frustrating as it is quite simple and I am trying it from yesterday. Still I am stuck. I am sure that nothing is connected with the Grovepi. Previously I have sent you the pictures and as you can clearly see that nothing is connected to that.

When I ran the firmware update, nothing was connected with the Grovepi except the power cable, the ethernet cable, USB stick and a memory card.

I have attached the picture which shows how it is powered on.

The Grovepi board was bought from the states directly from dexter industries.

Hi @lokeshpakal,

Sorry for the delay, I was discussing with my team with your issue and we suggest you to try a different power supply like using a MicroUSB cable and a computer or using a Mobile charger to Power the GrovePi.

Also I have uploaded a test script named avrdude_test.txt with this post. Run this script in your Pi using the command sudo bash avrdude_test.txt and reply with the avrdude_log.txt that is generated in the Desktop of your Pi.
avrdude_test.txt (203 Bytes)

-Shoban

Hi @Shoban,

I changed the power cable with a mobile charger and the firmware was successful. I did not run avrdude_test.txt you mentioned earlier.

I ran high_accuracy_barometer_example.py and it works. I have attached the picture.

However I tried too much but was not able to test grove_led_blink.py and I do not know why.
Could you please tell me the pressure I am getting using high_accuracy_barometer_example.py is a sea level pressure or not?
If I want to multiple high-accuracy sensors to this example, then how can I do that? Any suggestion will be helpful.
Thank You.

Hi @lokeshpakal,

Glad that you got the GrovePi responding. Average sea-level pressure is 101.325 kPa, and it can be seen here. Hence Pressure values that you are getting using high_accuracy_barometer_example.py is a sea level pressure.

It won’t be possible to use multiple High accuracy HP206C barometer sensor with grovepi as all of them have the same i2c address and there address’ can’t be changed.

If you wish to use multiple sensors then you must try using BMP280 or BME280 Barometer sensors as these support two different i2c addresses and also SPI interface.

Can you tell us to which Port were you connecting the LED and a picture of your setup to help you better to get the grove_led_blink.py working.

-Shoban

Hi @Shoban,

Unfortunately I have ordered some more High accuracy HP206C barometer sensors to test as I was not sure about it previously. So is there any possible way, we can make it using a connected or an extender and then splitting them and connecting them to multiple sensors?
But in case if I use BMP280 or BME280, then can you please tell me what is the maximum number of sensors I can use in this case?

For the LED, I connected to D4 as it was mentioned on the code but it did not work. The set up was the same (same like the barometer set up). The only thing I changed was the port and the sensor.

Lokesh

Hi @lokeshpakal,
It looks like the hp206c doesn’t support more than one i2c address, hence it will not be possible to use multiple hp206c on a single Grovepi board.

In case of BMP280 or BME280 you can use a maximum of two sensors on the same GrovePi board. BMP280 and BME280 support i2c addresses 0X76 and 0x77 and Hp206c supports the address 0X76. Hence it would not be possible to use these sensors in combination. You will have to use either BMP280 or BME280 sensors alone. Thus you can use a maximum of two Barometer sensors with one GrovePi board.

Can you also tell us if there are any reasons for using multiple barometer sensors on a single board of GrovePi.

For the LED example, if you had used a Grove LED socket, try changing the polarities of the LED connections on the Grove sensor LED socket.

Please tell us know if this helps,
-Shoban