For one of my hobby projects, I wanted to have my source code under source control. Professionally I use VSTS (Visual Studio Team Services) https://www.visualstudio.com/team-services/pricing/ which is great. But this is a hobby project which I code alone. So I did a git init and committed it locally.

I moved the complete Visual Studio solution + project (folder) and hidden .git folder to OneDrive and the cpu started to heat up. OneDrive keeps syncing and uses a lot of cpu. I tried to exclude the .git folder, but that did not help.

So what is the solution?

  1. Move the full folder inc .git hidden dir outside OneDrive
  2. git init –bare c:\Users\youruser\OneDrive\reponame.git
  3. in the dir outside OneDrive: git remote add onedrive c:\Users\youruser\OneDrive\reponame.git
  4. git push –u onedrive master

Do not forget to push sometimes to the remote. Or use in Visual Studio the “commit & push” button.

Thanks to Qiuwen Chen for pointing me in the right direction.

Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn

It all starts with installing Windows 10 IoT on a suitable device. I used a Raspberry Pi 2 (Model B) and installed the creators update of Windows 10 IoT. You should really get the dashboard from Microsoft: https://developer.microsoft.com/en-us/windows/iot/downloads


It is really easy to get Windows 10 IoT on your device. Here is a small manual https://developer.microsoft.com/en-us/windows/iot/docs/iotdashboard


If you have your Visual Studio 2017 configured, you can easy deploy to it.

The hardware

I bought stuff from aliexpress. I had no rush, so saved a lot of money Smile

I was inspired by this article https://www.modmypi.com/blog/raspberry-pi-plant-pot-moisture-sensor-with-email-notification-tutorial but that referenced to a moisture sensor for 4 gbp and shipping was also 4 gbp. So just the sensor could cost me 9,40 eur. Which makes it less fun, because the whole idea of a raspberry pi is that you can make an internet of things device with little costs.


I spend only 42 cent on the sensor and bought some male/female, male/male, female/female jumper cables too and even an hdmi to dvi connector so I could connect an external monitor, but never used it.

Ali Url snip_20170504112536

€ 0,42

Ali Url snip_20170504112647

€ 2,19

Ali Url snip_20170504113017

€ 1,14


So I had to spend € 2,61 euro including shipping to get the parts for my Pi 2.

Hardware wiring

Connect the probe to the sensor with two wires. Doesn’t matter which goes where.

Connect the sensor to the GPIO

VCC 3v3 Pin 1
D0 GPIO 17 Pin 11






this is a good page for gpio pins: http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/



I hit a strange bug with the UWP but fixed it, thanks to stack overflow, by manual creating a project.json file. As said, I was inspired by this article but that is coded in Python. My preference language is still C# and I wanted to try win 10 iot. So I rewrote this python code to C# and got this: 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.UI.Core;
using System.ServiceModel;
using LightBuzz.SMTP;
using Windows.ApplicationModel.Email;

namespace BackgroundApplication1
    public sealed class StartupTask : IBackgroundTask
        private const int SENSOR_PIN = 17;
        private GpioPin pinSensor;
        private BackgroundTaskDeferral deferral;

        private const string SMTP_SERVER    = "smtp-mail.outlook.com";
        private const string STMP_USER      = "YOURPLANTSADDRESSHERE@hotmail.com";
        private const string SMTP_PASSWORD  = "YOURPASSWORDHERE";
        private const int    SMTP_PORT      = 587;
        private const bool   SMTP_SSL       = false;

        private const string MAIL_RECIPIENT = "iwillwatertheplants@hotmail.com";

        public void Run(IBackgroundTaskInstance taskInstance)
            deferral = taskInstance.GetDeferral();

            taskInstance.Canceled += TaskInstance_Canceled;

            var gpio = GpioController.GetDefault();

            if (gpio != null)
                pinSensor = gpio.OpenPin(SENSOR_PIN);

                var r = pinSensor.Read();


                var dm = pinSensor.GetDriveMode();

                pinSensor.DebounceTimeout = TimeSpan.FromMilliseconds(50);

                pinSensor.ValueChanged += PinIn_ValueChanged;

        private void PinIn_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
            if (pinSensor.Read() == GpioPinValue.High)
                SendMail("Thirsty", "Plant needs water");
                SendMail("I am good", "Plant is fine again");

        private async void SendMail(string subject, string body)
            using (SmtpClient client = new SmtpClient(SMTP_SERVER, SMTP_PORT, SMTP_SSL, STMP_USER, SMTP_PASSWORD))
                EmailMessage emailMessage = new EmailMessage();

                emailMessage.To.Add(new EmailRecipient(MAIL_RECIPIENT));
                emailMessage.Subject = subject;
                emailMessage.Body = body;

                await client.SendMailAsync(emailMessage);

        private void TaskInstance_Canceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)

I used the nuget "lightbuzz-smtp" to send mail https://github.com/LightBuzz/SMTP-WinRT

Have fun with Windows 10 IoT raspberries etc.

Pin on pinterest Plus on Googleplus Post on LinkedIn

Make sure you have Windows 10 with the anniversary update or newer.

You can verify this by pressing the winkey + R and type ‘winver’ and hit enter. The anniversary update has buildnr 14393. And make sure that you have the “Bash on Ubuntu on Windows” feature enabled.

Xmllint is not included by default, so you have to install it first.

sudo apt install libxml2-utils

You can read more about xmllint on http://xmlsoft.org/

in order to format a large XML file which has no line breaks you have to use xmllint like this:

xmllint --format input_xml_file.xml > pretty_output_xml_file.xml

You use the format option on the input_xml_file.xml and redirect the output (>) to a new file with the name pretty_output_xml_file.xml

This is a lot faster than opening the file in notepad++ and use the xml plugin to format it.

Hope it helped. Good luck!


Pin on pinterest Plus on Googleplus Post on LinkedIn

Here are the 9 steps to enable the linux subsystem in the latest Windows 10 version:

  1. Windows key + I (to go to settings)
  2. Update Windows
  3. Select developer menu on left hand side
  4. Make sure that the developer mode is enabled
  5. Go back to the main page of settings
  6. On the right hand side click “programs and features”
  7. Click on install additional features on the left hand side
  8. Check the box for the linux subsystem
  9. Double click on c:/windows/system32/bash.exe to install it



I had to blog this, because the GUI option mentioned on msdn did not work on my locale (nl_nl)



Read more about it on MSDN https://msdn.microsoft.com/en-us/commandline/wsl/about

Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn

I started my IoT (Internet of Things) journey a bit later then some. I waited for a suitable small project to come along and some free time. The creators update (Windows 15063) has just been released and apparently also the IoT version of the creators update.

I already had the Visual Studio RTM version of 2017 on my machine. I have worked with several release candidates of the 2017 version, but updated as soon as possible to the RTM update. The SDK and everything else was already setup and ready to go.


When I started with file –> new project and selected the background application I got this error:


“Could not add all required packages to the project.” That’s odd because this is just a file new project…

The package causing this is: “Microsoft.NETCore.UniversalWindowsPlatform.5.0.0” Unable to find version 5.0.0 of package Microsoft.NETCore.UniversalWindowsPlatform

When I manually ran the install-package command in the package console I got more info. The Jit package was also failing to install (dependency)


I did not see how to fix it, so I turned to stack overflow. Rita Han from Microsoft reached out and confirmed that the solution workaround given by Wind Rider was the solution to my issue.

My solution explorer looked like this after the file new project and the popup with the error:


The project.json had a yellow exclamation mark and checking it with explorer, it was not available on disk. So there is no file… that’s odd.

The workaround from SO was to manually create a project.json with this content:

  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
  "frameworks": {
    "uap10.0": {}
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}

and then manually edit the .csproj file.

navigate the the “ItemGroup” of project.json and add below the </itemgroup>

    <SDKReference Include="WindowsIoT, Version=10.0.15063.0">
      <Name>Windows IoT Extension SDK</Name>

This will cause visual studio to reload things. Installing the Microsoft.NETCore.UniversalWindowsPlatform package now works Smile


Good luck, hope this reference helped!

Pin on pinterest Plus on Googleplus Post on LinkedIn