Rasperry Pi Rasbian Linux, Ubuntu and Windows 10 Python Azure IoT hub Sensor Streaming Samples
As at September 2016 samples are built on Azure IoT SDK 1.0.15.
- Raspberry Pi Zero, Raspbian Kernel 4.4 fully patched
- Python 3.4
- Enviro pHAT for temperature, barometric, and light sensing
- Raspberry Pi 2 and 3. Tested on Raspbian Kernel 4.4 fully patched
- Python 3.4
- Raspberry Pi Sense HAT
- Windows (10) Subsystem for Linux Python 3.4
- Python 3.4
- Open Weather Map Data
- Windows 10
- Python 3.5
- Open Weather Map Data
The samples include the compiled iothub_client.so library for ARM V6 (Pi Zero), V7 (Pi 2 and 3) and Ubuntu X64. But you still need to install the Azure SDK Python prerequisites.
Follow these steps to install the Azure SDK Python prerequisites :-
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
cd azure-iot-sdks/python/build_all/linux/
./setup.sh --python-version 3.4
No additional software required.
To compile your own iothub_client.so library follow these instructions.
Note you should allocate in the order or 5 to 6 hours to compile the Azure IoT SDK on the Raspberry Pi Zero.
- Increase Raspberry Pi Swap File size - see notes below
- Overview of preparing your Python Development Environment
- Compile Azure IoT Device SDK for C
- Compile Azure IoT Python Libraries
- To find your Raspberry Pi on your network by name install Apple Print Bonjour Service on Windows for mDNS UNIX Name Resolution. .
- My favourite SSH and SFTP Windows Client is Bitvise
- Visual Studio Code for Windows, Mac and Linux
-
For Windows Remote Desktop Connection Support
sudo apt-get install xrdp
Raspberry Pi Zero โ Programming over USB ONLY works with Raspberry Pi Zero and provides a quick easy way to connect your PC to your Raspberry Pi Zero.
To compile Azure SDK on the Raspberry Pi you will almost certainly need to temporarily increase the size of the swap file. See How to change Raspberry Pi's Swapfile Size on Raspbian
Be sure to change the swapfile size back to the default after the SDK has been compiled.
sudo nano /etc/dphys-swapfile
The default value in Raspbian is:
CONF_SWAPSIZE=100
Change this to:
CONF_SWAPSIZE=2048
Save changes
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
free -m
The output should look like:
total used free shared buffers cached
Mem: 435 56 379 0 3 16
-/+ buffers/cache: 35 399
Swap: 1023 0 1023
Be sure to change the swapfile size back to the default after the SDK has been compiled.