Hardware

Monitoring Temperature and Humidity in the House

In our house, we sometimes have problems with mold in outer corners, so four months ago we built a series of inexpensive IoT sensors for monitoring temperature and humidity. Our devices are made from just three components: WeMos D1 Mini (lite) microcontroller Si7021 temperature and humidity sensor 3x AA Ni-MH rechargable batteries Because we wanted to build around 10 sensors, we had to watch out a bit for the price tag on the components.  We ended up at around 9 € per device, with 50% of the cost beeing the batteries. We chose the Si7021 sensor because judging from this excellent review of common temperature sensors, it was better than the commonly used DHT22 and came in 2nd place behind the more expensive BME280. For the power supply of the devices it was clear that we were going to run them on rechargable battery using deep sleep.  Andreas Spiess made an…

Python

JSON (De)Serialization of nested objects

During my first encounter of handling JSON (de)serialization in Python, I faced the problem of (de)serializing objects that have properties that are instances of another class. Using the json module, one has to write two methods, a complex_handler and a class_mapper that are fed to json.dumps and json.loads respectively. The design problem here is that the class_mapper needs to compare a dict that is to be deserialized with the properties of potential classes in order to find the matching type. In the first level of deserialization one could potentially provide the type as a parameter to the deserialization-function, but as soon as there is a child property, the type may be unknown. Therefore each class that is to be deserialized has to be registered into a collection of (properties) -> class mappings. To simplify the handling, I wrote the following JsonConvert class: Now we can define some classes and make…

Machine Learning

Running Tensorflow with native Linux Binaries in the Windows Subsystem for Linux

After 4 hours of unsuccessful attempts to set up tensorflow in Docker on Windows, I decided to – just for fun – try to run it in the shiny new Windows Subsystem for Linux on my Windows 10 Insider Preview Build 14332. What began with low expectations turned out to be very successful, so here are the steps: First enable the Windows Subsystem for Linux in the “Turn Windows features on or off” dialog: Then open the Ubuntu Bash and update the package index: You can now proceed to install pip for Python 2: Now install the CPU-enabled Linux x64 tensorflow package:: Tensorflow is now installed. With the following command, you can get the directory of the installed package: This should give something like “/usr/local/lib/python2.7/dist-packages/tensorflow”. Now let’s cd to the directory with the example implementation of a CNN for the MNIST dataset: And run the convolutional neural network: In the…

C#

RCSwitch for Windows 10 IoT

RCSwitch is a library for controlling remote power sockets from Arduino. The original source code by Suat Özgür can be found on GitHub. In combination with the MX-FS-03V sender MX-05V receiver, I wanted to do the same thing on Windows 10 IoT on my Raspberry Pi. To use RCSwitch in a Windows Universal app, I ported the library into a C++ Windows Runtime Component. The RCSwitch port to the Windows Universal Platform is now available on NuGet. To use it in your IoT project, just install the NuGet package and then copy these code samples: Create an instance of the RCSwitchIO class: Turning remote power sockets on/off: In good .NET fashion, you can also subscribe to an event to listen for incoming signals: However I found that receiving does not work very reliably. Initially I was able to sometimes receive signals, but a few weeks later (with a different remote)…

C#

Learn and Predict the Gender of German Nouns

The German language is know to be relatively complicated and especially the gender causes lots of confusion. While English has only one article (the), three different articles are used in German: der (male) die (female) das (neuter) While rules to determine the gender of a noun exist, almost no German native speaker can name them. We can now solve this problem (determine the gender without memorizing the rules) using some simple machine learning with the Accord framework. Let’s quickly name the steps that will follow: find and extract a dataset of noun-gender associations split into training, test and validation dataset extract features into something the algorithm can use train a Naive Bayes test the model with the test dataset After quite a while of searching, I found this machine readable and CC-BY-SA 4.0 licensed XML file from Daniel Naber. In our Universal Windows App we can then load all nouns into…

Uncategorized

iGEM Aachen 2014

You might have wondered why it got a bit more quiet on my blog. Now here’s why: Because of the iGEM competition 2014. The iGEM competition is an international competition in synthetic biology that debuted at MIT in 2004. Since then it has grown to more than 230 participating teams from all over the world. Over the last ten years it has significantly shaped the international synthetic biology community. In 2013 a few friends and me heard of the competition and founded the first team from RWTH Aachen. Up until March 2014 our team grew to 15 students of Bachelor and Master programs in Biology, Biotechnology, Biomedical Engineering, Computational Engineering Science and Computer science. After almost a year of hard work, we finished our project “Cellock Holmes – A Case of Identity” and flew to the Giant Jamboree (Finals) in Boston, MS, We had fulfilled all criteria for the gold medal…

C#

Replay Practice

Are you playing an instrument? Yes? Then you probably know what it is like when you’re practicing the same few notes all over again! Sometimes playing it slower can help too. With Replay Practice you can do exactly that. Choose a song, move the markers and loop a part of the song at a speed of your choice. Replay Practice is available for Windows Phone 8.1 and Windows 8 !  

Arduino

Arduino as a MIDI/Bluetooth Relay for Windows 8.1 Apps

In my last post I described how a Bluetooth connection between Arduino and a Windows 8.1 device can be established. The next step for me was to connect the Arduino to my electronic drum kit which has both, a MIDI-IN and a MIDI-OUT jack, but any other electronical instrument will do as well. The wiring diagram for an Arduino Uno R3 with MIDI-IN/OUT and the JY-MCU Bluetooth module is shown in Fig.1. NOTE: Occasionally there are MIDI shields available for Arduino, so you might not have to build it on your own. The Arduino code to relay MIDI>Bluetooth and Bluetooth>MIDI is actually quite simple. //======================================================authorship //by Michael Osthege (2013) //======================================================includes #include “SoftwareSerial.h” //======================================================constants const int TX_BT = 10; const int RX_BT = 11; const int MIDI_TX = 1; const int MIDI_RX = 0; //======================================================bluetooth setup SoftwareSerial btSerial(TX_BT, RX_BT); //======================================================initialization void setup() {     Serial.begin(31250);     btSerial.begin(9600);     Serial.println(“Bluetooth initialized”); }…