PiMKRHAT is an adaptor to use Arduino MKR boards and shields together with the Raspberry Pi. Different Arduino MKR Shields can be used via our HAT as extension for the Raspberry Pi. I want to show in this small project how to use the Arduino MKR ENV shield with a Raspberry Pi under Python.
The PiMKRHAT comes as kit. You have to assemble it first. Please follow the attached assembly instruction
Please set for the Arduino MKR ENV shield only the 5V and 3, 3V Jumper on the Power jumper bank. Leave all other jumpers open.
RaspbianPlease download the latest Raspbian OS for the Raspberry Pi and copy it to an SD card via Pi imager
Configuring I2CThe sensors on the MKR ENV shield are using I2C communication. You have to install some libraries first via the bash:
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools
Now you have to enable the I2C interface:
sudo raspi-config
--> 5 Interfacing Options
--> P5 I2C--> YES
sudo reboot
Testing I2CNow it's time to test the I2C interface:
sudo i2cdetect -y 1
This shows that two I2C addresses are in use – 0x10, 0x5c and 0x5f
Install additional librariessudo apt install python-pip
sudo pip install veml6075
Test3 little Python programs are available to test the UV radiation, temperature & humidity and pressure sensor of the MKR ENV shield:
HTS221.py -temperature and humidity
LPS22HB.py - pressure
VEML6075.py - UV radiation
The analogue light sensor requires an analogue input and can not be used with the Raspberry Pi.
Comments