Profectus Est!

(It is started!)

Project Water my Plants has begun. This blog post marks the arrival of the first bits of electronics, and provides a simple overview of how the getting started with gadgeteer felt like.

White stripe spider plant
Image 1: The victim: A white stripe spider plant(Chlorophytum comosum ‘Vittatum’)

My box of Gadgeteer devices has arrived. I’ve found a suitable plant to experiment with and all of the software required to get started is now installed in two places (on my desktop and on my laptop (for field experimentation). As you can see from the brown bits, this plant is already suffering, and requires immediate attention of the highest technical quality to survive…

Overview of the project

The project has been set up using Visual Studio 2012 and will be managed by Team foundation Service, which will also function as my source control provider.

 Initial Solution Layout
Figure 1: Overview of project layout

The project structure follows the typical N-layered approach as seen on the image above. Within folder 10.10 (Application/Micro Framework) is where the electronics software are made – the rest of the folders are hosts to the Web page and Web Services. The Specifications folder contains screenshots and some frameworks for running the project in a BDD harness using a combination of SpecFlow and CasperJs 

Getting started with Gadgeteer

DSC_8618
Image 2: The Gadgeteer Moisture sensor half buried in the plant soil

Installing the .Net gadgeteer project was straight forward, except for a couple of things:

  • You should install the entire 4.2 SDK, and then upgrade to 4.3
  • There is a Visual Studio 2012 compatible Core + Templates for Gadgeteer that you need to install once you’re done installing the 4.2 stuff, otherwise, you won’t be able to see the Gadgeteer application project types.

     

    Once installed, creating the project was as easy as adding a new project to the solution, choosing Gadgeteer Application and following the wizard:

    Gadgeteer Wizard
    Image 3: The first page of the wizard asks what type of mainboard you have

    The wizard starts by asking what type of mainboard you have, and then proceeds to create a diagram where the mainboard is visualized. From there, it is as simple as just dragging the components you want from the Toolbox onto the designer, and connecting them by clicking on the gates and drawing a line:

    Gadgeteer Designer in VS2012
    Image 4: Using the designer tool to drag the components and connect them to the board

    Auto-generated code

    Every time you save the designer, the auto-generated partial class Program is updated with the new components and port assignments. The generated code is clean and easy to understand. No cluttering or cryptic names here. The module names are default the same as the module type.

    OGadgeteer Designer Generated Code
    Image 5: Designer-generated code

  • Measure My Plant

    The first batch of electronics to arrive were needed for my first application, MeasureMyPlant.exe which is a device application that is going to do two things:

    1. Take readings of the environment that the plant is in (moisture, light, temperature)
    2. Transmit data over wifi to a cloud service in Azure

     

    Only part 1 was done in this stage, because I waited with the more expensive WiFi component to get a cheap proof of concept going. It turns out that I should’ve ordered everything at once. The electronics simply worked! Within 5 minutes of typing, I had the following program running on the Hydra board:

    MyFirstProgram
    Image 6: My first running program on the hydra board

    Time to order some more stuff!

    I will now proceed with some of the more expensive modules. While I await the arrival of these, I will be working on the website. There may be a blogpost or two about that soon…

    For now, a few more images of the protagonists of this blog post:

    DSC_8625
    Image 7: The modules used in this blog (click for larger image)

    DSC_8620_Snapseed
    Image 8: My Fez Hydra mainboard with all the connection ports(click for larger image)

    Watt’s a dog?

    – “Yes he is”

    My old blog server was sucking out roughly 700 Watts/Hour. By buying a new, modern, cheap PC, I’ve reduced the cost of hosting my own blog to 1/10th of what I was paying!

    How much was the old server costing me?

    700 watts on idle setting means 0.7 kWh, 24 hours a day, 365 days a year = ~6100 Kwh per year! This was an age-old Compaq Proliant Server with two power supplies and a series of cooling fans – not only did it pollute my power bill, it also made a serious amount of noise!

    Given today’s power prices, that means roughly  3,000 NOK ( 368 EUR / 511 USD) per year just for having my blog available 24/7! Something had to be done, and fast!

    Options

    I started to look for a replacement by checking out some servers, but most of these use around 200W of power, and were fairly expensive compared to desktop PC’s (I wanted at least a dual core and 2GB RAM)

    I looked into a few Windows Home Servers, but  frankly, I need IIS7, and dont want to limit myself to what I can do on that platform. It is a point, however, that Home Server CAN host WordPress, and HP MediaSmart is rumored to use around 80W/hour, which is not bad at all!

    Cheap desktop PC to the rescue

    I landed on a cheap-ish Packard Bell iMedia PC (image below) that looked like a match for the job. Priced at roughly the same as a year worth of server power, I got a dual-core AMD processor with 3GB of ram and some 300GB of drive space. plenty  for hosting IIS7 and WordPress on MySql, and no restrictions in case I want to deploy an ASP.NET application or two.

    Packard Bell imedia Desktop PC

    Once at home, I hooked it up to my watt meter and low and behold, the darned thing does not use more than 50W on balanced setting (around 62W on high performance setting)

    50W is a number I can live with 24/7!! I’ve got lightbulbs that use more than that! New cost per year (in power):

    238 NOK ( 29 EUR /  40 USD)

    That is less than the monthly fee for using one of the cheaper web-hotels out there!

     

    Conclusion

    Investing roughly a year’s worth of electrical power to my old web-server, I was able to cut the power consumption of my blog to 1/10th. Since I don’t have that much traffic, the hardware is more than able to respond to my needs, and I got rid of that old, noisy huge box that was doing nothing but costing me money. Less electricity spent = more frogs to kiss somewhere…

    You’re actually reading this on the new hardware right now!