Hi, thanks! I already looked at the Compass library over the weekend, and was able to re-write the Arduino C++ example for the Barometer on the Seeed site into Python.
Here is the code, in case anyone else wants to try this.
Sorry, the forums won’t allow you to upload Python files. Try renaming and uploading it as .txt file instead of a .py file. Something even better would be if you could send us a pull request on the Github Repository https://github.com/DexterInd/GrovePi .
We’ll love to integrate it with our existing codebase. Let me know if you are able to get the Dust sensor to work.
. . . so . . . if I understand this correctly . . . which I probably don't . . . I'll have to create a unique ID for the Dust Sensor. Then, I will need to add an "if(cmd[0]== unique ID)" section to grove_pi_v1_1.ino. In that section, I will need to add code like the example here: http://www.seeedstudio.com/wiki/Grove_-_Dust_sensor
Now, this is the step that scares me, because I have never programmed an Arduino before, I will need to build the firmware, and update that on the Arduino. I did find a partial description of how to do this here: http://www.dexterindustries.com/forum/?topic=firmware-modification
Unfortunately, this isn't quite detailed enough for an Arduino n00bie like me. For example, when I look at the source that I cloned from the Git repository, I see this in the firmware part:
root@HymasGrove:~/hymas/GrovePi/Firmware/Source/v1.1# find .
.
./dependent_libraries
./dependent_libraries/DHT_sensor_library
./dependent_libraries/Grove_RTC
./dependent_libraries/DigitalAccelerometer_MMA7660FC
./grove_pi_v1_1
./grove_pi_v1_1/grove_pi_v1_1.ino
So I see the .ino file, but the dependent library directories are empty. Will the build process find them somehow . . . ? And how to I need to invoke the Arduino IDE? Start a VNC session on the Pi, and then just click on the .ino file? Or do I need to invoke the IDE from somewhere specific in the tree?
Thanks for any help you can give me!
Hi,
You are in going in the right direction.
The missing libraries were a problem from our side. Thanks for letting us know. We have updated the repository and they should be there.
You can compile and upload the code using the Arduino IDE. It’s already installed on the Dexter Industries Image or SD card. You’ll need to make some changes if you are not using the Dexter Industries Image. Run this script if you are not using our image: https://github.com/DexterInd/GrovePi/blob/master/Script/install.sh .
You can access the Arduino IDE from the Start button on the LXDE on the Raspberry Pi . The Arduino IDE is in the Electronics section.
So show sending back data works is that, you send a command for GrovePi to do something and the GrovePi executes it and stores some data in the buffer . Then you send a command to read data back if you want, so the GrovePi sends you back the data that is in the buffer from the last command.
Hope that this helps.
Let me know if you need any more help.
Hi! Well, I can talk from my Python host code to the Arduino code now. So I am starting on talking to the sensor. Is it possible in the Arduino to read the Serial.println() messages?
It seems to want to read them from COM1:, but I don't see where I can set it to something else.
Hi,
The Serial on the GrovePi is not connected to the Serial on the Raspberry Pi. If you want to connect the Serial between the Raspberry Pi and the GrovePi, then you’ll have to connect the two portsRPISER and SERIAL using a Grove cable.
You’ll also have to modify the cable before connecting. The normal grove cable comes with the following color code: BRWY <-> BRWY. You’ll have to invert the white and yellow wires at one end so you’ll have the cable as BRWY <->BRYW . You can do it by just pulling up the small platic above the metal contact on the connector and pulling the wire out. Do this for both the yellow and white cable and push them back in the new position.
Try out a basic Serial print example in both the wire configurations and if it works then only move forward.
COM0 won’t work on the serial port of the Raspberry Pi. To use the serial port, run: ln -sf /dev/ttyAMA0 /dev/ttyS0 in the Terminal and a new serial port will appear in the Arduino IDE.
This setting goes away on restart and if you want to load it automatically on boot then do this.
Open crontab: crontab -e
Add this entry at the end of the file: @reboot ln -sf /dev/ttyAMA0 /dev/ttyS0
and It’ll load the Serial port up at boot.
There is one more thing that you have to be cautious when using the Serial Port on the Raspberry Pi. If you open the Serial Port and the Arduberry is sending a lot of serial data continuously then the Raspberry Pi processor usage will shoot to 100% and it can easily hang. Limiting the data being sent and received helps a lot to run the Raspberry Pi smoothly.
I just finished my Python scripts for the Grove Digital Barometic Sensor and the GrovePi. I based it on the Adafruit_BMP085.py, but made some alterations on the calculation of the altitude (using a better formula for the barometic hight formula).
Hi Johan,
It would be great if you could send a pull request in the Dexter Industries repository too. We’ll be happy to integrate them with out current supported sensors.
I just pulled one request in the Dexter Industries repository for the python scripts for both the grove digital light sensor and the grove barometic sensor. I’ve changed the files names so they have the same structure as the other files in that repository:
Johan,
I have run the grove_i2c_barometic_sensor_example.py example and I get 4 error messages “Error accessing 0x076: Check your I2C address” and the readings displayed look like defaults (-3.20 C, 999.77 hPa, 143.76 m). I’m using this sensor https://www.epictinker.com/ProductDetails.asp?ProductCode=SS-811027001. Any help would be appreciated.
Hey,
We do not support this sensor right now. This is a pretty new sensor and is compatible with the GrovePi but we don;t have the library or example for it right now but we might develop one for it in the near future. If you like, you can start developing the library for it and contribute back. We’ll be more than happy to help you out.
Karan, that is very disappointing news. What ‘help’ can you provide? It’s been a long time since I was a developer. If you can point me in the right direction, perhaps I can make a go of it.
Hi tfeeney,
Sorry for the frustration. This is a pretty new sensor and we have not received it yet to try it out and get the driver code working. We might get a new sensor in the coming weeks but no ETA on this yet.
and when I run the example for grove_i2c_barometic_sensor_example.py, I am getting “Error accessing 0x076: Check your I2C address” and I am getting some default reading. It will be helpful if you kindly provide a sample example of using this sensor.
Thanks.
It looks like you are trying an example which would work with Barometer sensor BMP180.
The link you have posted points to a High accuracy HP206C barometer sensor. If this is the sensor that you are using then you must try the high_accuracy_barometer_example.py from here.
Thanks for letting me know. Can you please provide a link to the example for using High Accuracy HP206C barometer sensor? I do not have BMP180 sensor.
It will be helpful.