Temperature Sensor – Mk II

My first go at creating a simple battery powered temperature sensor was really interesting and fun to do, but, like any project, there are always way to make it better!

For my Mark II sensor, there were a few things I wanted to improve:

Mesh Networking

I’m interesting in exploring the concept of mesh networking. Within the Expressif family of devices, there are two flavors that I’m aware of; WiFi mesh and Bluetooth Low Energy Mesh. The ESP32 platform supports both of these. My current Temperature Sensor is built upon the ESP8266, but moving to the ESP32 should be straight forward.

In Progress – .

More Data

Mk I of my sensor was a simple temperature probe. I wanted to expand on this after I found the Bosch BME280 sensor. This little sensor can capture temperature, pressure and humidity. The boards I ordered work on the I2C protocol, so I’ll have to figure that out.

Not started.

MQTT Discovery

I use the Hass.io platform to manage my automation at home. It supports a simple MQTT interface for receiving data and sending commands. Typically, you would configure the devices within a config file, but it does support a discovery protocol, which allows devices to make themselves known to Hass and to provide all the information required for Hass to use them.

I would like my temperature sensors to support this mode, so that when they fire themselves up for the first time, they would register themselves automatically.

Not started.

Battery Life

Not started.

Housing

I’d like to enclose my sensor in a nice case, so that I can mount them on the wall in way that doesn’t look completely ugly!

Not started.

Low battery notifications

Not started.

Best laid plans, part 2

After my little boo-boo with measurements, I purchased a new Wiska junction box from RS, this time with a little more width and the Sonoff relay fit perfectly! I also picked up some IP66 glands to help secure the wire from the LED strip.

IMG_5011

This junction box had a membrane covering each hole, so I pierced a hole in it and fed the table through. The gland then screwed into the threaded hole (what makes these Wiska boxes so great).

IMG_5013

I tightened it all up.

Sadly, I didn’t take any pictures of my SWA cable gland process as I did it at lunch time. This was the tricky part of my installation since it required a hacksaw. I found a great YouTube (https://www.youtube.com/watch?v=epmxqFiD9JI)  video and followed that as best I could. I didn’t have the “glanding spanners” as recommended, but I made do with pliers. I do plan on using another armoured cable to connect to the other side of the garden, so I’ll take photos of that.

Anyway, with everything installed, I dropped the box in the garden.

IMG_5014

You can see the thick black SWA cable and the thin LED cable. I should point out that this is not the final resting place of this box!

IMG_5017

The lights look pretty nice in the snow and light the garden pretty well.

This weekend I plan on getting a few metres of SWA and using the small junction box to hook up the lights on the other side of the garden!

Best laid plans…

Wanted to work on my garden LED lighting project weekend. Unfortunately, I may have made a slight miscalculation with my measurements…

IMG_4996

I placed an other with RS for a replacement box, this time a little wider! If all else fails I can always take the circuit board out of the case and place it directly in the junction box, but I’d rather keep it housed.

I did manage to test it out though and the lighting is effective enough.

IMG_5002

Maybe next weekend?

 

Apple Bonjour for .Net Core

As part of my work on building a .Net implementation of Apple Homekit protocol, I want to have it run on a Raspberry Pi. My plan is to accomplish this using Windows 10 for IoT. This is basically a cut down version of Windows 10, designed to run .Net Core and UWP apps. I haven’t really explored it very much, but it seems to suit my needs. I can deploy my Homekit service and put the Raspberry Pi in the cupboard.

The first piece of functionality I need for my Homekit implementation is the broadcasting of the accessories using Bonjour. Bonjour is apple’s zero configuration protocol implementation. It is available on Windows, via Apple’s SDK, but unfortunately, it’s a COM component, so running it on Raspberry Pi is a non-starter. I searched around on the internet for a few hours and discovered, to my immense disappointment, that there are no Nuget packages for advertising services over Bonjour. Lots of ones for browsing and searching, but none for advertising.

These kind of situations, whilst annoying, do provide an opportunity to learn something new. What would it take to create a simple implementation of Bonjour that would run on .Net Core, on a Raspberry Pi. Let’s find out 🙂

To get the ball rolling, I created a .Net Core console application in Visual Studio. This doesn’t achieve anything in and of itself, but makes me feel like I’m making progress 🙂

A read through a few articles on Bonjour;

and I was ready to start. General searching around the web, led me to RFC-6762 (https://tools.ietf.org/html/rfc6762), which describes Multicast DNS or mDNS. This is used by Bonjour. I do love a good RFC.

After reading the first few pages, I established the following facts; mDNS, in essence, works by resolving .local addresses e.g. computer.local or hap.local. It does this by sending requests over multicast to the group 224.0.0.251 on the port 5353. I had come across the multicast technology (my router didn’t support it) a few years ago, so I was familiar with the main concepts.

Converting this into code, I came up with

public void Start()
{
 try
 {
 UdpClient udpClient = new UdpClient();

udpClient.ExclusiveAddressUse = false;
 IPEndPoint localEndpoint = new IPEndPoint(IPAddress.Any, 5353);

udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
 udpClient.ExclusiveAddressUse = false;

udpClient.Client.Bind(localEndpoint);

IPAddress multicastaddress = IPAddress.Parse("224.0.0.251");
 udpClient.JoinMulticastGroup(multicastaddress);

while (true)
 {
 Byte[] data = udpClient.Receive(ref localEndpoint);
 string dataAsString = Encoding.UTF8.GetString(data);
 Console.WriteLine(dataAsString);
 }
 }
 catch (Exception exp)
 {
 Console.WriteLine(exp.Message);
 }
 }

This code essentially listens on port 5353 for broadcasts to the group 224.0.0.251.

When I fire up the console app, I just see this

Console

Not much to see. In order to generate some Bonjour traffic, I use an app called Bonjour Browser

I launch this and again, I don’t see much:

Bonjour

However, a few lines appear in my console app:

Console with data

Right now I don’t have a clue what these are, but I can see what might be dns requests.

More detail to follow!

 

IIS 0x80070020 when starting a website

As a developer, I run IIS on my PC so that I can test my websites using ForwardHQ. Sometimes, however, I will have an issue starting a particular website and IIS will throw up this dialog.image

“The process cannot access the file because it is being used by another process”. Totally cryptic and totally useless.

Most of the time, I can get around this by doing one simple thing:

Kill Skype.

image

When I return to IIS and try to start my website, it starts without issue.

Worth a try next time you run into this issue.

Git.exe crashing on Windows 10 Insider Build 14251

Yesterday, I upgraded my desktop to the latest Windows Insider build, 14251. I’ve successfully installed and worked on the previous Fast Ring insider builds over the past few months and I haven’t had any issues.

Unfortunately, this build was the exception. My first clue was Github for Windows telling me there was something wrong with my repository. It was unable to sync. I removed and cloned the repository again, but the error persisted. Running ‘git pull’ and ‘git push’ from the Powershell didn’t seem to do anything, which was odd. So I installed git.exe directly and the installer reported an error. Running git.exe just resulted in a “git has stopped working” message.

I decided not to waste any time on debugging this and I rolled back to the previous build, without issue. Thankfully I was back up and working within an hour.

This experience will temper me in the future and I might just drop back to the Slow Ring Smile

CALENDARING in the 21st century – a shambles!

I received an meeting appointment email today that had an ICS file attached. It was from an Australian client, so getting the meeting into my calendar with the correct time is very important. If the meeting is scheduled for 6pm, Sydney time, it needs to go into my calendar in British Summer Time. Seems pretty simple.

Sadly, it’s not. I’m using Windows 8.1 Update 1 at present. In my Mail app, I can see the appointment very clearly. As I use a single calendar for my appointments, hitting the “Accept” button would just add it to the wrong calendar, so instead I click on the invite.ics file.

image

And this is what pops up! WTF?

image

A quick search of my machine shows I don’t even have Outlook installed!!!

image

I would, at the very least, have expected this to open in the Metro Calendar app. Sadly, this app doesn’t seem to support this file. What a joke.

To add insult to injury, the Windows OS is actually bested by iOS, which supports ICS files without issue. Typical.

Simple activity notifications for your applications

As part of my work on Drinks4-You, I decided that I wanted to get an alert to my phone each time a user signs up. I’ve worked hard on the platform and the other members of the team have worked even harder on generating sales and promoting the platform, so getting a little alert each time we get a new customer is very exciting!

Rather than a vanilla email each time a user signs-up, I wanted something a little more dramatic. A signup is an important thing, so I wanted an alert to match the gravity of the situation. What better then the Inception “BWONG” noise?

I spend a few hours and created a simple iOS  that would display the notifications and play the cool noise!

I then began to wonder if other people might need something similar. I quick search revealed plenty of providers of Push notifications, but they required that you have your own app. A small company might not have any iOS expertise or cannot spare the to create an iOS app for just one thing.

From this, Heads Up was born.

Heads Up is a simple iOS app that lets you register for notifications from your own apps. Your app only has to send a PUT to our Heads Up API and your device (or devices – using a PIN code other people can get the same notifications e.g. members of a team) will receive the message and play a sound. It’s simple, but can be used to alert you of errors in your service, important user activity or for a bit of fun.

Marketing1

You can sign up for the Heads Up mailing list if you want to be part of the beta test. I will be charging for the service eventually as I need to cover hosting and network charges, but until it launches officially, the beta will be completely free.

Sign up for the beta using TestFlight

Selling a Roomr–How I sold some Objective-C code.

Apologies for the terrible title!

I recently completed the sale of some iOS code that makes up my room booking app, Roomr (www.roomrapp.com) to a company in Belgium. A user on Twitter asked if I would write a short post on the sale and voila, here it is.

To give you some background, my app Roomr is a simple iOS app that connects up to Microsoft Exchange and allows you to view the status of meeting rooms. In addition, you can see a room’s full daily calendar and also book meeting rooms. All from your iPhone. To the best of my knowledge, it’s the only app of it’s kind.

Despite it’s uniqueness, sales have been very slow, topping around 25 a month. I’m putting this down to a few factors, but they are outside the scope of this post!

Around mid-April, I got an email from a developer in Sweden asking if I would be interesting in selling the source code of Roomr as they had an in-house project to develop an app with some similar functionality. They stated that I’d retain ownership of the code and would be able to continue developing upon it and Roomr itself would remain in the store. This seemed like a good proposition.

I just needed to put a price on my code.

I reached out to Twitter for some help and got lots of answers and suggestions. The common thread running through the responses was that the sale would be worth about 20%-30% of the total development effort. So if I spend 100 hours writing the software, I could charge for about 30 of those hours. This made some sense when I considered that I had no documentation etc.

I agreed to the sale, but my client needed to get approval before we could continue.

Time passed, as it does, when another email arrived in my inbox from a company in Belgium offering to purchase the code for Roomr and even offered a price. This price, I’m pleased to say, matched what I had quoted the Swedish developer, so having some validation there was nice. We discussed terms and they matched the previous offer i.e. I’d retain ownership and could continue to develop and sell Roomr.

I agreed to the sale and began looking into software escrow as I assumed my buyer would want some contractual guarantees as well as safeguards to their money.

The buyer didn’t seem interested in that and offers to wire me the money in exchange for the code to be sent via email. I was surprised by this. Perhaps I’m getting too cynical, but it was nice to be trusted like that. I agreed that once the money was received, I’d transfer the code. I sent them an invoice and my bank details and one day later the money arrived in my account. I promptly zipped up and emailed the code over. A second email swiftly followed as I had neglected to include a 3rd party library causing compilation failures.

And that was it. The transaction was completed with all parties being happy. I managed to recoup some of the time I spent developing Roomr and I hopefully saved my buyer time understanding Objective-C driven SOAP calls to Microsoft Exchange!