Tag: software

It only took 4 years, but I finally found enough time to build a new mobile app and update an existing one. Things have been busy to the point where my weeknights are taken up with other things, and any software development has to be done during the day. Sometime last year I had another idea for a mobile app utility and decided to build it properly to learn about Android store processes and online advertising. Here’s what I built and how the process worked.

Log – flexible data tracking

Like the name says, this is the app idea I came up with last year to solve a problem I couldn’t find an existing app for. It’s a data journal that provides the ability to create custom streams of data and track those over time. The streams can contain multiple inputs like numbers, text or dates, and get added to the list. For example, track driving trip distance or count the number of times you go to the gym. It’s all manual and offline.

Learn a lot more about it at thelogapp.com.



Equation Library

This was an app I wrote back in 2014 and it received a surprising number of downloads. I ended up not having enough time to commit to its maintenance and let it sit for too long. Recently I reviewed the tech needed for it to work and decided it was new enough that I could do that. So I spent a few evenings rebuilding it with the latest SDK and made some improvements.

The application itself works by including a number of math categories that have equations I’ve collected from my textbooks and online sources. Each equation can solve for the primary variable and most provide the ability to solve for additional variables. My hope is that as people use it and start to request categories I can slowly build a much larger database. Fortunately the new system is much easier to update and maintain than it was previously.

The hard part comes after

If you’re proficient at mobile development, building the apps themselves isn’t that difficult. I wanted to use the process of updating the apps to learn about online marketing and advertising, so it turns out that the hard part is just getting noticed. I think the market has shifted significantly since I started building small utilities in 2011 and I’m surprised at how much people don’t want to spend on apps now. So far targeting ads with Facebook and Google has not resulted in many sales, but I’m still learning so hopefully that starts going up as I do more.

Give the apps a try!

Tagged with: , , , ,

Arduino, PowerSwitch Tail 2, humidifierMechatronics is described as the intersection between mechanical, electrical and computer engineering, and it covers just about anything that uses electronic signals to act on mechanical systems. It’s what I went to school for, and it’s where my hobby interests lie. The Arduino is a fantastic example of how people with limited experience can jump right into mechatronics projects. I’ve been tinkering with them for a few years, and decided to put the components I had to good use by taking a timid step to home automation.

Indoor humidity can affect the comfort level of a home pretty dramatically. Since warm air can hold far more moisture than cold air, the humidity inside during the winter falls dramatically. This drop can cause an increase in static electricity, sickness and dry, itchy skin. Too dry and a home can just feel downright uncomfortable. Too much humidity when the outside temperature is low can also cause condensation on the windows and mould growth. Some humidifiers have a built in control system to maintain the proper level of humidity, but what if yours doesn’t?

By combining an Arduino with a basic humidity sensor and relay, you can trigger your simple humidifier to only come on when needed.

Bill of Materials

With these pieces combined together, you can find the indoor temperature and humidity, and adjust the humidifier’s set point manually to achieve the proper moisture level.

Assembly

Complete breadboardHere are some links about connecting the different components that make up the system.

Additionally I have a few bonus status LEDs for displaying when the correct humidity has been reached (although you’ll be able to tell from whether the humidifier is on or off). The great part about the Arduino community is that most of the major components have libraries dedicated to their functions, so you can spend less time figuring out how the hardware works and more time thinking of projects.

Control System

The control system is the set of governing equations and parameters that determine what behaviour the system’s output should have. In this case, it takes in the current level of moisture in the air and tells the relay to switch the humidifier on or off. For that reason, it’s a type of control system called “closed-loop”, because turning the humidifier on will increase the sensor value and trigger it off.

There are many other different types of control systems but we’re fortunate that the main type in use here is called an “on-off controller” for its inability to adjust output values. Like a furnace, the humidifier can be either on or off, with the time in each state determining the magnitude of change. Compared to a PID controller, which uses error correction to maintain a system, the on-off controller is far simpler.

The complete source code is available to download below, but I’ll go through some of the important parts here.

Temperature and humidity outputEven in a relatively simple system such as this, it’s important to follow proper coding patterns. This means using the Model-View-Controller paradigm to retrieve sensor data and output to the screen and relay. In even simpler terms, it means storing the inputs as variables and refreshing the screen rapidly with those variables. For that, it’s a good idea to use something like a Timer class to handle running specific methods at an interval without blocking the main program.

With the button, I’m able to toggle between two states: normal and setting. Doing that is easy with enumerations.

Each time the button is clicked, the state of systemMode is changed, and the display is updated accordingly.

Toggling display modesThe ModeSetting value is where a new setpoint for the control system is entered. When TARGET is displayed on screen, the encoder LED flashes (again with another timer) and turning the encoder updates the value.

While the above links show a clear way of entering the new encoder value, here’s my function.

You only want to update the target value if the current mode is Setting and the new encoder value is different from the previous.

Whenever the system mode returns to normal, the controller checks if the current value is where it needs to be and updates the relay accordingly. However, it’s not as simple as turning the relay on when humidity is below the target and turning it off when it goes above. If that was the case, there would be far too much cycling. That means as the error approaches 0 (humidity reaches the target), the actual value could repeatedly go across the threshold and cause the humidifier to cycle on and off quickly. I’ve set the refresh rate to be 1 minute, but even that would be annoying if it cycled that quickly. To fix the problem, we need to introduce a control system property of hysteresis, which in simplified terms means making the humidifier stay on until it passes the target by a few percent, and not turning on until it’s a few points below the target. This way it cannot rapidly switch between the on and off states. In code, that might look something like this.

Here, the variable correct is the value of whether the system is currently at the desired level, and hysteresis is the percent of padding (2% here).

What this block is essentially saying, then, is “if the humidity is currently above the desired value, don’t turn on again until the humidity is below target – 2” or “if the humidity is currently below the desired value, stay on until the humidity rises to target + 2”. In this way, the system won’t turn on and off in quick succession.

Connect the PowerSwitch relay pins to ground and an Arduino 5V output, and set the state of the pin according to correct. Then sit back and listen to the satisfying click of the relay as computers do your job for you.

Controller and humidifier together

What’s next?

Since this current version requires you to set the target point on the humidifier manually, it’d be nice to make that automatic, too. But how? The problem is that indoor humidity is linked to outside temperature, as I mentioned above, so that means you need to find out the local temperature and adjust the humidity accordingly. That can be done any number of ways, like adding a WiFi or ethernet shield to the Arduino.

This is something I’m planning on doing, but I’m going a slightly different route so that I can build on it for more advanced home automation. By building an Xbee network, I can make nodes that act as sensors or outputs and connect them all to a central computer. Since I already have Ubuntu server, that part is taken care of. I can log data to the server and have it request local weather and tell this Arduino whether the humidifier should be on or off.

But the fun wouldn’t even need to stop there. By designing the network right, suddenly you can add other components to do things like turn lights or appliances on or off or alert you when a window is left open at night. Where will you take it?

Tagged with: , , , ,


My Ubuntu file server is almost complete. With multiple terabyte hard drives in place, software for sharing files among computers on the network, it provides all the services a modern home network requires. However, one of the things it is missing is PVR functionality, which MythTV provides.

MythTV is one of the premier software packages to come out of the open-source movement. It has been developed by hundreds of individuals who work in their free time to generate software that useful to an even greater number of people. Built for the Linux platform, it is very robust and feature filled. This power comes at a price, however, and MythTV is famous for being stubborn to install and maintain. Originally I wanted to write a blog post about how I installed a TV tuner card and conquered MythTV to create an amazing home server package, but instead I need help.

After adding a Hauppauge HVR-1600 to a PCI port in my mid-tower, I installed the drivers and firmware and set about installing MythTV. This has proven impossible because I cannot run the setup program. As shown by the image at the top, whenever I run mythtv-setup through an Xserver session on my MacBook Pro, no video is output and the interface becomes unbearably slow. I’ve consulted with many different forums and no one has been able to offer advice, so now I want to get help from the internet at large. Has anyone see this while installing MythTV and knows how to solve it?

Here’s my hardware setup to clarify things.

  • OS Ubuntu 9.04 CLI
  • TV Tuner Hauppauge HVR-1600
  • Network Gigabit
  • Remote terminal OS Mac OS X 10.6.4
  • Remote terminal hardware MacBook Pro 13″ Dec 2009 GeForce 9400m
Tagged with: , , , , ,