IoT temperature sensor based on RaspberryPi3, written in .NET Core
- Install raspbian OS on RaspberryPi device
- Install .NET Core Runtime on RaspberryPi device
- download avalaible at microsoft pages
- select Linux/ARM32 version
- install in
/home/pi/dotnet
directory - add
DOTNET_ROOT
environment variable pointing to dotnet installation directory
- Generate application binaries
- open project in Visual Studio
- in Package Manager Console enter following command:
dotnet publish -r linux-arm -c Release --self-contained false
- Copy binaries to RaspberryPi device
- binaries location
IotHome.RaspberryPi.Console\bin\Release\netcoreappX.X\linux-arm\publish
- copy to
/home/pi/Apps/IotHome.RaspberryPi
directory - coulde be copied using WinSCP application
- binaries location
- Modify appsettings.json file to reflect your needs
ConnectionString
device connection string to Azure IoT Hub serviceProcessingIntervalInSeconds
Logs directory
SensorSettings
enable/disable desired sensors, currently supported sensors: chipset temperature, DS18B20 and random (for testing purposes)
- Add execution rights for
IotHome.RaspberryPi.Console
appchmod 777 IotHome.RaspberryPi.Console
- Start app
./IotHome.RaspberryPi.Console
- Create
RunIotHome.sh
file in application directory with contentDOTNET_ROOT=/home/pi/dotnet /home/pi/Apps/IotHome.RaspberryPi/IotHome.RaspberryPi.Console
- Add execution rights for newly created script
chmod 777 RunIotHome.sh
- Go to
/home/pi/.config/autostart
, create if doesn't exist - Create
RunIotHome.desktop
file, with following content:
[Desktop Entry]
Type=Application
Name=IotHome.RaspberryPi
Exec=/home/pi/Apps/IotHome.RaspberryPi/RunIotHome.sh
- Application should start after reboot, if not check logs
- Connect sensor DS18B20 via 1 wire interface
- Run
raspi-config
and enable 1 wire- Interfacing options
- 1-Wire
- reboot device
- you can check whether sensor is properly connected by running
lsmod
command,w1_gpio
andw1_therm
should be visible
- List avalaible devices by ```ls /sys/bus/w1/devices``
- Entry like
28-000008d6bac6
is our sensor address, copy it to appsettings.json file