It didn’t quite end up like that, and we ended up talking about what was requested, which was great. In my case, not only did I get to chat about Bots and ML .NET, but also got to speak about Xamarin and IoT too, which for me is always just plain awesome!!!
I started programming when I was 5. The ZX Spectrum started it all, back in the 80s. I recently started collecting ZX Spectrums. I’m also busy with IoT projects on Azure. Anything can really use Azure IoT Hubs, so how better to illustrate this than combine my two passions. 🙂
A great test of the contrib drivers is Pimoroni’s Rainbow Hat. https://shop.pimoroni.com/products/rainbow-hat-for-android-things The Rainbow HAT brings together a lot of the components mentioned above on one board. It’s provided with the Android Things Starter Kit so it’s a very good place to start. The first sample I’ve added here focus’s on this specific HAT.
The sample added is based on the google Weather Station sample. It has one difference, it uses Azure Iot Hubs for cloud messaging.
Push Button (A) to swap display from Temperature and Pressure on the board display
Native UI for RaspberryPi to display weather based on air pressure
Telemetry sent from Android Things Device to Azure via Azure Iot Hubs
Message support from Azure to Android Things Device.
To uses the Iot hub in the sample, the DeviceId, DeviceKey and HostName of an Azure Iot hub will need to be provided. I will do a post specific on Iot Hubs to provide more detail on this in subsequent blog posts. These variables are set in the MainActivity.
private bool _useHubs = true; // Set this to true to use Azure Iot Hubs
_weatherDevice.DeviceId = "<Add Azure Iot Hub Device Id Here>";
_weatherDevice.DeviceKey = "<Add Azure Iot Hub Device Key Here>";
_weatherDevice.HostName = "<Add Azure Iot Hub Hostname Here>";
I’m in the process of creating more samples of the rest of the contrib library. I’m also packaging more third-party drivers from around the community into reusable Nuget packages for Android Things with Xamarin.
I’m also having a lot of fun at the moment with a version of these drivers, built from scratch to work with Xamarin Iot. We can then have these components (and Rainbow HAT) working on Linux devices which will of course be awesome!
That was using Xamarin Iot on Visual Studio for the Mac (Preview). Xamarin Iot is also however available for Visual Studio 2017 on Windows (Preview 2.1) too. Below is the identical solution just running from Visual Studio 2017 on Windows. Have a look!
This is just a quick look at Xamarin Iot running on a Raspberry Pi Zero, this time on Visual Studio on Windows. More in-depth content coming soon!
This is a first look at the new Xamarin Iot functionality found within Visual Studio for Mac 7.1 Preview. I will dig much further into detail in future posts, but lets have a very quick look and it. I’m really excited about this addition to the already awesome Xamarin tooling!
A new project type has been added for Iot. This project type or template will create the solution and project needed to run on the Iot device.
What’s immediately apparent is the new run option for the Iot project type. There’s now a new item called “Manage Devices”
The Iot Device Manager allows all the connected devices to be managed. This setup is very similar to the Mac Agent used for iOS development with the Xamarin Visual Studio for Windows extension, however it will display all the Linux based devices running on the network. In this case and screenshot it’s a Raspberry Pi Zero running Raspian (Jesse). Configuring the device will allow remote deploys to the device from your Mac. This will require a user name and password of a user on the Raspberry Pi. This user will be used to connect to the Raspberry pi via SSH. Also note, SSH needs to be enabled on the Raspberry Pi for this to work.
Now you can start developing your Iot solution. What’s really awesome is, all the things you expect to work will just work. This includes break points and a full debugging experience. All this can happen wirelessly to a “headless” device.
The build and execution process is very similar to the Mac Agent when you do iOS development from Windows (Visual Studio) to a Mac. The difference in this case, it is from a Mac (Visual Studio) to a Linux instance (Raspberry Pi). On the very first execution, the mono run time will be copied over to the device. This will be used to execute the built app. The application itself and it’s “built code” is also synchronized with the Raspberry Pi. This compiled Iot app is then in turn executed on the device remotely.
Lets see it in action! Here is a simple example of the now standard Iot demo of a flashing LED, but running on a tiny Raspberry Pi Zero W. What’s really nice about this implementation is, it runs on devices that is not supported by other Iot platforms, like Android Things and Windows 10 Iot Core. It will run on the myriad of Linux based devices out there.
There is much more to show and tell. So there’s much more blogs to come on this topic! This will also include how Android Things and Xamarin Iot can work together to make cross platform Iot simpler.