Azure-Samples / iot-hub-c-raspberrypi-client-app

Application collects weather data from a BME280 sensor and sends it to IoT hub, also take actions according to cloud-to-device message, device management.
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-c-get-started
MIT License
36 stars 34 forks source link

Working setup: RPi3 and Bullseye #40

Open krambriw opened 2 years ago

krambriw commented 2 years ago

I started using the sample with the script but it did not work, failed on multiple things, so after reading and googling numerously, the following steps finally worked for me:

For example in C

Install CMAke
sudo apt-get install cmake

Install GIT
sudo apt-get install git-core

Fix libssl
sudo apt-get purge -y libssl-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev

Update PI
sudo apt-get update
sudo apt-get upgrade

Reboot
sudo reboot

Git the Azure IOT SOurce
cd ~
mkdir Source
cd Source
git clone --recursive https://github.com/azure/azure-iot-sdk-c.git
Build the Azure IOT Source
cd azure-iot-sdk-c/build_all/linux
./build.sh --no-make
cd ../../cmake
make
sudo make install

Git the Azure C Shared Utility
cd ~
cd Source
git clone --recursive https://github.com/Azure/azure-c-shared-utility.git
cd azure-c-shared-utility
mkdir cmake
cd cmake
cmake ..
cmake --build .
sudo make install

Install Sample App Source
cd ~
git clone https://github.com/Azure-Samples/iot-hub-c-raspberrypi-client-app.git
cd ./iot-hub-c-raspberrypi-client-app

Install wiringPI
sudo apt-get install wiringpi

Install parson
git clone https://github.com/kgabis/parson.git
cd ./parson
mv parson.c parson.h ..
cd ..
rm -rf parson

Set the sample "Simulate Data" as required
sed -i 's/#define SIMULATED_DATA 0/#define SIMULATED_DATA 1/' config.h

Make the sample
cmake . && make

Run the sample
sudo ./app 'DEVICE CONNECTION STRING'