New Project: Sunroom datalogger

We noticed the sunroom in our new apartment gets to >100 degrees F on a sunny day when the outside temp is only 65! This spurred the idea to try logging the data which will let me build something relatively simple but interesting. I was hoping to use an ESP32 or the older ESP chip, but I didn’t have one on hand (I do own an ESP32, but I’m not certain where i put it, and I’ve moved since then.)

One of the benefits of purging a bunch of project stuff and equipment is that I can feel fine about just buying something for a project as needed. I ran to MicroCenter and looked for things with WiFi, since I want to send the data to a database somewhere.

I settled on a Raspberry Pi Zero W, which I got for $5. I was hoping to run Windows 10 IoT or even .NET Core 2.0 which just came out (because I’ve been doing C# lately and want to not learn a new language for this), but those both need a Pi 2 or better. I should have gotten a Pi 3+, though that seems insane to throw at a project like this. I could use a Pi 2 that I have, but I’d have to pull it out of another project, which I’m not usually a fan of.

One thing I do remember from last few Rasp Pi projects, is that there are a lot of steps needed to set up basic things, and it’s not always easy to remember what tutorial worked in the end. So this set of posts will be my documentation of what I learned putting it together, and at least a few links of the resources used. I also happen to be doing this on a new Windows 7 PC that I just acquired, so I can also list off the tools installed there.

Getting Started Windows

  • I installed PuTTY as my ssh client of choice.
  • I installed Visual Studio 2017 (I used Pro, because I have a license, but might try VS Code or Rider instead anyway)
  • for VS2017 I made sure to install the .NET Core 1.0 desktop tools since .NET Core 2.0 won’t work on the Pi Zero W.
  • For C# IO on the Raspberry Pi to talk to sensors, I plan to start with Raspberry# IO. I installed this via NuGet

Getting Started Pi

  • First things first is to get the Pi set up with an OS. I used Raspbian Stretch Lite burnt to a 16GB card using Etcher.
  • I used sudo nano /etc/wpa_supplicant/wpa_supplicant.conf to add my wifi information, then rebooted.
  • sudo raspi-config let me change the default hostname, password, keyboard layout, enable ssh, enable vnc, etc. This also proved the wifi to be working since it was able to download packages as needed here.  I wrote the (non default) password on a sticky note to store in the case. This is not a high security project.
  • I added a new iot user to the NAS to give it access to a single shared folder for passing files around. I followed this guide to mount the new shared folder to the pi automatically on startup.
  • Mono was installed following this guide.

At this point I put the Pi in a case and removed the monitor and keyboard. It’s kind of weird to have such a tiny computer just sitting there and logged in via ssh.

Hello World

The usual first app to get the toolchain going is needed. Since VS2017 has support for .Net Core 1.0, 1.1, and 2.0, it of course defaults to 2.0 for new projects.

  • Create a standard HelloWorld app
  • In the project properties, change target framework to .NET Core 1.1
  • I followed this project example from Microsoft to get a basic app that compiled and ran on my laptop.
  • Publishing the app was a bit of a rabbit hole. it finally came down to needing the .NET core framework installed. See here, which links to here (here for .NET core 2.0).
  • The final command for the prereqs was sudo apt-get install libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev uuid-dev
  • I then installed docker because of this, but i think that was not the right place to go.

So far still can’t run dotnet –version, so clearly more work to do. I think it’s because I’m trying to run on .Net Core instead of compiling an exe again st .NET Framework 4.0 and then running it using mono.


Things I haven’t used yet that seem useful:

Leave a Reply

Your email address will not be published. Required fields are marked *