NPK Soil Sensor with RASPBERRY PI 4
HTML-код
- Опубликовано: 7 фев 2025
- Soil NPK sensor can be connected to RPI4 UART to get N P K Values.
Buy link :
www.alselectro...
Code download :
99ba69f9-3a9c-...
sudo nano /boot/firmware/config.txt
add following line after the enable_uart=1
dtoverlay=miniuart-bt
this overlay swaps the BT to use mini uart instead of UART0.
RS485-TTL Auto Direction model is used to connect with RPI. Connection is straight Tx-Tx, Rx-Rx
G-G
Always use Virtual Environment in RPI.
python3 -m venv --system-site-packages npkenv
confirm by checking home folder npkenv is created.
source npkenv/bin/activate
python3 -c "import serial; print(serial.VERSION)"
If it prints 3.5 without errors, pyserial is working, and you can continue with your script
nano npk_sensor.py
to execute
python3 npk_sensor.py
Sir i am currently doing this project can i do with your code and get the right data or i have do use the usb also?