Updated SDK
This week there was an update of the SDK for the Azure Sphere so I thought I'd download that and the other tools I was using. The SDK now has support for storage, real time clock, storage and external MCU flashing, although it looks like the documentation and examples need a bit of work still.
https://azure.microsoft.com/en-us/blog/update-18-11-for-azure-sphere-in-public-preview/
One message in the update was that there was a updated network driver for running a VPN over USB. There's two interesting points about this, firstly it should mean that the data travelling between the programming machine and the board should be secure. The other is that it should mean that the technology is simpler as both OTA and USB connections are using the same approach.
I was looking forward to seeing the RTC but there seems to be just one function call to "sync" the clocks, I'll have a look into that.
There were also some other internal changes as the old Blink example that I'd built previously now did not work. So I just loaded up the new template instead. This annoying but an expected side effect of working with beta software.
Hooking up hardware
Once I'd got blink working I thought I'd try that again with an external LED.
I swapped out the red LED with one of the GPIO pins on header 1 and fired up the code. The debug console returned the following.
Opening MT3620_RDB_HEADER1_PIN4_GPIO. ERROR: Could not open LED GPIO: Permission denied (13).
That's because I'd not updated my app_manifest.json to include GPIO0 aka Pin4. Once I'd done that the code worked fine.
UART
So we can determine the position and orientation, I purchased a Ublox NEO-M8N GPS & Compass. This was packaged for use with a drone flight controller so I needed to swap out the connector with some suitable for the 0.1in pins. I'd found some wiring examples online but my colours did not match so I unscrewed the case to re-assure myself and was glad to see the connectors were labelled.
Using the U-Centre tool and a USB to TTL adapter, I experimented with different Baud rates until I got some output. The module seems to continuously stream messages. There's a massive 300 page manual on the protocol but I've ascertained that there's commands that can be sent to turn on and off the different messages that are streamed. I'll also take the device outside (or perhaps under the skylight) so I can see if I can pick up some satellites.
GPIO / Stepper Motor
For the stepper motor, I had a couple in my drawer but the 28BYJ-48 was a good size and also had a suitable ULN2003 board to drive it. I slimmed down and ported the code from the Topsy Turvy Clock.
https://github.com/Workshopshed/IOTCompass/blob/master/Mt3620App/Mt3620App/stepper.c
And then tested it first with just the LEDs and the debugger, then running with the motor.
Top Comments