Hot answers tagged

6

Linear for the win! y = (slope * x) + intercept is the classic linear formula, in your case, x=sensor, y=bars, so the formula becomes bars = (slope * sensor) + intercept ... and you have two data points of this formula, sensor@750, and sensor@3750 equation 1: 0 = (slope * 750) + intercept equation 2: 250 = (slope * 3750) + intercept ... lets rearrange ...


5

I assume you have not connected anything to those inputs. The inputs will therefore be floating and return random results. It's probably simplest to connect unused inputs to ground if you do not like this behaviour.


3

since a picture is worth a thousand words:


3

This is normal. ADC inputs are made very sensitive on purpose, and will work as antennas picking up all kinds of noise when not connected to anything. Periodic noise can usually be traced to your mains voltage, which you can confirm by sampling the pin 200..500 times per second.


3

Yes, (in general) in this case you should wire the ground terminal of all devices in your circuit together. This provides the necessary common ground reference voltage for them to interoperate. Your voltage divider needs to go from 5 vdc to 3.3 vdc. There are two considerations in setting up a voltage divider: a. it provides the proper voltage, and b. ...


3

There is only one thing to bear in mind. Only feed between 0 and 3.3V to a Pi GPIO. Anything outside that range will eventually damage the GPIO and then the Pi. You have to consider each device you wish to connect on a case by case basis. Generally if a device is powered from 3V3 its outputs will be a Pi safe 3V3. Generally if a device is powered from ...


3

I recommend this repository for ADS1115 for RPi in Python and for Arduino. Calibration Reset Read the values https://github.com/DFRobot/DFRobot_PH You can adapt to your project and works properly. /* * @brief Init The Analog pH Sensor */ void begin(); /* * @brief Convert voltage to PH with temperature compensation * * @param voltage : Voltage ...


2

Its under 'Interfacing Options' then 'I2C':


2

I'll take a shot at this. You can test this with the on board variable resister (ADJ) or the onboard photocell (LDR). First, remove all normal sensors. Second, short the ADJ and AD0 pins of the rightmost header. Third, short the LDR and AD1 pins of that header. Then you can measure the voltage of the builtin sensors of the board. Use the knob on the lower ...


2

Everything looks fine. Yes, you need to connect the Pi ground to the ground of any sensors you connect to the GPIO. It doesn't matter if they are powered by the Pi or by an external power source. You need a common voltage reference so both ends know what's high and what's low. The resistor divider is fine. There are many examples on-line. This is ...


2

You can indeed use serial communication between the Arduino and the Raspberry Pi. According to the Raspberry Pi docs: By default, the UART transmit and receive pins are on GPIO 14 and GPIO 15 respectively, which are pins 8 and 10 on the GPIO header. The same page indicates that the serial pins are used, by default, to communicate with the Raspberry Pi's ...


2

If you are using a properly-sized power supply, then I believe this to be a timing issue. Since the distance sensors work when you're only using four threads, then I suspect that it's not a power problem. The SR04 requires precise timing to calculate distance. If one of the other threads is taking too much of the CPU time, then perhaps the thread that reads ...


2

You should not need to use sudo with i2cdetect. The most likely problem is not connecting ADO to either ground or 3V3.


2

I wanted to add an improved version of the code which uses timeouts to make sure the script doesn't hang: import RPi.GPIO as GPIO import os import time # Define GPIO to use on Pi GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO_TRIGGER = 23 GPIO_ECHO = 24 TRIGGER_TIME = 0.00001 MAX_TIME = 0.004 # max time waiting for response in case something is ...


2

I would suggest 2 changes. Firstly it is possible that the program can get stuck in the while loops so add a timeout. Secondly initialise the pulse_start and pulse_end variables incase the while loops don't get entered. This could be improved to ignore results where the timeout has been used. import RPi.GPIO as GPIO import time try: GPIO.setmode(GPIO....


2

https://tutorials-raspberrypi.com/raspberry-pi-ultrasonic-sensor-hc-sr04/ This can be good start for you. This example gives the time and distance calculations. You can trigger the Image capture of camera with your specified time.


2

Part 1 - Calibration Procedure 1. Analog output offset procedure Offsetting meter analog output of 0.0V to + 2.5V for compatibility with ADC such MCP3008, MCP3208 etc. Cheap pH meters are almost always designed for Arduino which has an analog pin A0 to convert analog signal to digital. Rpi, sadly does not have any analog pin, so must use an external ADC ...


2

From How to use a pH sensor with Arduino Calibrate the sensor As we can see that there are two potentiometers in the circuit. Which it is closer to the BNC connector of the probe is the offset regulation, the other is the pH limit. Offset: The average range of the probe oscillates between negative and positive values. The 0 represents a ...


2

I would connect SDO to ground. This ensures the ADXL345's I2C address is 0x53. If you connect SDO to 3V3 the address will be 0x54. It may float between the two if not explicitly set to ground or 3V3. I would connect CS to 3V3. This ensures the ADXL345 is in I2C mode. If it is ever low the ADXL345 will enter SPI mode. Other than that I am out of ideas ...


2

I used to measure temperature on the Raspberry under different load. I remember if you used something on the USB port, or the ethernet, the chip driving USB and ethernet becomes hotter than the CPU. (I have a 3B+) But this should be true on the 2B. Anyways, the differences will be very very tiny. Try find an infrared thermometer if you want to be sure ...


1

Yes, you can use both sensors at the same time on the Raspberry Pi. The DHT11 uses just one GPIO to trigger a reading and return the result. The MQ-X sensors return an analogue signal and require an ADC (Analogue Digital Converter) to be read by the Pi. Typical ADCs use the I2C bus or the SPI bus on the Pi. You need to choose solutions for both devices ...


1

I found the solution to this problem: First of all read @joan 's answer for an explanation as to why the error occurs. Secondly, run the following code: sudo i2cget -y 1 adress <-- adress needs to be replaced by what is in your table with the i2cdetect command as shown below! In my case the adress is 0x68, the command will return something like 0x83 (...


1

The bus address is 1 (as in the 1 used in -y 1). The command sudo i2cget -y 0x68 0x68 is saying read device 0x68 on bus 0x68. 0x68 hex is 104 decimal, which is why it complains about the non-existent bus 104. I presume you mean to enter sudo i2cget -y 1 0x68


1

The dependency on GPIO is an artifact of the TSL2561 python library referenced above. The one I was trying to use has the dependency on Adafruit_GPIO, which introduces complications when also using rpi.gpio. However, with more searching I found this TSL2561 python code in ControlEverythingCommunity that only imports smbus. As correctly noted by @joan, there ...


1

This appears to be an adaptation of a buggy Python script. Personally I'd use it as a test to distinguish between people who can program and people who can script. while(gpioRead(ECHO) == 0) { startTime = gpioTick(); } while(gpioRead(ECHO) == 1) { stopTime = gpioTick(); } What is meant to happen is a sonar trigger is sent and then ECHO remains ...


1

I figured it out with a little help: Circuit Python doesn't work with this sht21.py, because it is smbus based. So here it is: I used the multiplexer code from this homepage but this is all I needed # TCA9548A I2C multiplexer # I2C Address: 70 through 77 # Channel: 0 - 7 import smbus # class for the I2C switch class TCA9548A(object): # init def ...


1

Yes, please be careful working with mains voltages as they can be lethal ! Ideally, all of your mains wiring to the relay should be in a separate enclosure that's properly grounded. If you're unsure about how to do this, please do your homework or ask questions here. As far as the photoresistor module controlling the relay state; the key is understanding ...


1

Patterns used on a given platform are conditioned by its userbase. Most novice users will find the concept of a loop much easier to understand than the concept of events, let alone multithreading. Typical UI applications are based on the same kind of infinite loops processing incoming data. The only difference is that the loop itself doesn't belong to the ...


1

There are many solutions to this project. Also, while the DHT11 sensor is well defined, simply saying "Ultrasonic sensor" is not. So only the DHT11 and Raspberry Pi will be included in this answer. One approach would be to use an ESP8266 WiFi based board to interface with the DHT11 and transmit data over WIFI to the Raspberry Pi. Here is one of many ...


1

Most of the time, if you supply only 3.3 volt to Vcc, the maximum output will be 3.3 volts. The FC-51 appears to have been used with Raspberry Pis before. This Python program at github.com appears to look for the FC-51 signal on pin 7 of the Raspberry Pi using the GPIO BOARD pin number method: import RPi.GPIO as GPIO import time pin = 7 GPIO.setmode(...


Only top voted, non community-wiki answers of a minimum length are eligible