I’ve gotten a i2c thermometer and humidity sensor that I’d like to measure inside of the electronics enclosure of my ROV. It’s currently plugged into the pixhawk. How can I/ can I read the sensor data over the tether on QGroundcontrol?
What sensor have you got? It will probably not be plug and play, new software will need to be written to support it.
The sensors are: Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board. What will the process be for writing the software, as I anticipate needing to add a wide range of sensors to the custom ROV that I am building.
If you want it to show up in QGC, it can take quite a lot of effort the first time around.
You will need to
- Write a driver for the sensor that runs on the pi or the pixhawk (The pi can be easier, or even an arduino connected to the pi if you can find an arduino library).
- Send the sensor value via mavlink or some other method.
- Receive the sensor value and display it in QGC.
How different will the pixhawk driver be from arduino driver, since I already have that, but I don’t not really space for an arduino.
Do you have an example of writing a driver for pixhawk that I could follow?
You can look at the source code for existing i2c sensors like the Bar100:
Great, I am working on writing the driver now. When that is done, how can I get it to be sent over MAVlink to QGC?
You will need to set something up in the vehicle code to do that. You can use the named value float messages like we do here.
Is there good documentation for the different I2C commands? With arduino, there is the Wire library which is very straight forward, but I am struggling to understand what is what with the I2C library for pixhawk.
No, your best guide from here will be looking at source code. Beware my initial warnings:
How would connecting the I2C sensor to Raspberry Pi work? Where would I write the code to get it to send data to QGC?
For that, it’ll be necessary to write a python or C++ code to communicate with your I²C sensor, after doing that, you should improve your code to connect with mavproxy, that is running already in your ardusub companion computer, and send mavlink messages like NAMED_VALUE_FLOAT, as Jacob described.
We have some pymavlink examples in ardusub.com.
So I am trying to install a library to the Pi, using the terminal, but I can’t connect to wifi. What is the problem?
Can you show us the error that you are seeing?
If you are using our rpi image, you should be able to connect to wifi by visiting 192.168.2.2:2770 in a browser.
I am using your rpi image, and am going to 192.168.2.2.:2770/network. Only one wifi network shows up, and even then it never connects to the network
Do you have the password for the network? Are you entering it correctly? Your router may be blocking the connection.
Yes, of course I have the correct password for the network, and have been entering it correctly.
I can see all of the networks when I enter:
sudo iwlist wlan0 scan
yet none of them show up when using the companion web interface
Interesting. There is a log file at ~/.webui.log. You can send that and I’ll have a look.
Did you get connected to wifi through the command line?
I was not able to. How can I find the log file?