Domotica using a NAS, a CA42, a Remeha heater and HTML5 part 2

I lost some time getting the CA42 to work. The cable I am using carries vendorID 0421 and productID 0802. A lot of suggestions on the web suggested to use the usbserial driver. I had to pass the vendor and product ID to the driver. This wasn’t working at all. Another one hinted about the cdc-acm kernel module. I started rebuilding the kernel modules for the Synology DS210j and copied cdc-acm.ko to the NAS. I created an entrypoint for the driver using the following instruction:

mknod /dev/usb/ttyACM0 c 166 0

I started the driver right after creating the entrypoint:

modprobe cdc-acm

 But you could also try:

insmod <location_of_kernel_modules>/cdc-acm.ko

The following command should NOT be executed although suggested by a number of people:

modprobe usbserial vendor=0x0421 product=0x0802

After starting the cdc-acm driver, the following was shown in my messages log:

[ 156.190000] cdc_acm 1-1.1:1.0: This device cannot do calls on its own. It is not a modem.
[ 156.200000] cdc_acm 1-1.1:1.0: ttyACM0: USB ACM device
[ 156.210000] usbcore: registered new interface driver cdc_acm
[ 156.210000] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters

So, /dev/usb/ttyACM0 is present ūüôā

I wrote a bit of C code to talk to my Remeha Avanta boiler and it seems to work too:

Sending 8 bytes to Remeha: 0x02 0x34 0x05 0x06 0x02 0x00 0x35 0x03
Waiting for an answer from Remeha...
Received 64 bytes from Remeha: 0x02 0x41 0x06 0x3e 0x02 0x00 0xa4 0x0b 0x22 0x0b 0x80 0xf3 0x00 0x80 0x00 0x80 0x00 0x80 0xb0 0x0e 0x48 0x07 0x78 0x05 0x7c 0x15 0x1c 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x64 0x00 0x00 0x00 0x01 0x01 0x09 0x00 0x00 0xff 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x9d 0x03

The communication part is solved, the Synology is able to talk to the boiler and the boiler responds. It’s time to get ready for part 3.

Advertisements
Posted in communication, domotica, User Interfaces | Tagged , , , , , , , , , , | 1 Comment

Domotica using a NAS, a CA42, a Remeha heater and HTML5

I want to have something to measure and show my energy consumption. A number of power companies in the Netherlands are offering gadgets for this purpose. Eneco offers Toon, Nuon offers the E-Manager and Essent offers the E-Thermostat.

But there is a catch, you are required to purchase a 3,5 euro software update plan. I don’t want to do this so I looked further and stubled uppon http://blog.hekkers.com and http://www.bwired.nl. These are websites belonging to domotica enthousiasts showing that there are good alternatives to the commercial products. These guys do have ‘gadgets’ in their house that monitor really everything ūüôā

Monitoring the gas and electricity consumption is easy, an Arduino and 2 CNY70 sensors will do the trick. This is documented by a number of people so building this should be easy. As for the CNY70, I guess that Eneco uses the same principle.

Monitoring how much gas is required for heating and how much for hot water is another thing. A number of posts on the blog at hekkers.net indicated that it is not difficult to get diagnostics data from a Remeha Avanta heater. Well, I am lucky since I own a Remeha Avanta heater.¬†¬†I went out and bought a Nokia CA42 cable and modified it to be able to connect it to the heater. This was a 15-minute job because it is documented very well. The cable will be connected to my SynologyDS210j NAS to fetch the diagnostics data from the heater. Go to¬†synohacks¬†to learn how to install the drivers for the USB2Serial adapters on the DS210j. This is the hardware part of the project, cheap and rock solid ūüôā

Now, I am writing 2 applications, this first one is a C application that run on the Synology DS210j. This application reads the diagnostics data from the heater and stores it in a MySQL database. This data can then be used to split the gas consumption into 2 categories namely DHW and heating. The second application will be an HTML5 based front-end getting the data from the database and display it using a number of nices meters. Since I am not that familiar with HTML5, i looked around on the internet and found SteelSeries on http://harmoniccode.blogspot.com/. Exactly what I was looking for, a number of very nice looking widgets, work of an artist. I take my hat for what has been delivered there. I also want to use some charts to show historical data, http://chrisvalleskey.com/html5-graph/ should help me with that.

So, I started a number of small projects to find out if I can make something similar to Toon. My approach is very simple, I could use an opentherm interface and control the heater setpoint but that is something for the future. I will follow up on this post as soon as I have something working. If you are into domotica and if you own a heater that uses the opentherm protocol to communicate with the thermostat, then please take a look at the following entry:

http://blog.hekkers.net/2012/03/04/opentherm-monitor-finished/

Before I forget, if you want to write C applications for your Synology, you need to cross compile the source code on your development system. I am using an Ubuntu 10.04LTS VMWare image and followed the instructions given at this link.

Talk to you later.

Posted in domotica, Uncategorized, User Interfaces | Tagged , , , | 2 Comments

SCADA software has gotten out of control

The subject of this post is the first line of the introduction of a SCADA suite that we use. It’s called Ignition and created by Inductive Automation. It runs on Windows, Mac and Linux.¬†

Features                            Download PDF

Ignition by Inductive AutomationTM is an industrial application server, used to create systems that cover the full spectrum between HMI, SCADA and MES. Its unique architecture enables rapid project development and deployment.
 
100% Web-Based
Ignition is web-based. Our server software is configured via your web browser. Our drag-and-drop designer and clients are launched from your web browser using our innovative web-launched technology. Tedious client installations are a thing of the past.
 
SQL Database Centric
Your data is always stored in an open, accessible format. Our SQL datalogger and tag historian feature are compatible with any modern SQL database. Ignition has native support out of the box for Microsoft SQL Server, MySQL, Oracle, and PostgreSQL. Our SCADA and reporting features can pull data in from multiple databases simultaneously.
 
100% Cross Platform
Ignition is written in 100% Java, making it the first mature cross-platform HMI, SCADA, MES package available on the market. Top-to-bottom support for all major operating systems opens new dimensions of architecture flexibility. Companies are now free to use the system they want – not the system they’re constrained to by outdated technology.
 
Unlimited Potential
Access is important for efficiency. That is why we don’t limit it with software licensing costs. Buying client licenses or tags will no longer hold up your project. This allows you to put your effort toward adding more functionality into your system, while providing access to everyone who needs it.

Check out the video.

Posted in Post OPC, Post Scada | Tagged , , , , , , , , , , , , , | 1 Comment

We would love to get a glimps of the software used in Honda‚Äôs robot ASIMO!

One of our colleague taped a Asimo live demonstration in Disney World Florida. We are very impressed with what Honda achieved.  You can just wonder on how soon  it could be possible to have a Asimo in every home. Imaging what it could do for the elderly and disabled people!
Asimo is short for Advanced Step in Innovative Mobility.
Although it is possibly also a reference to the famous science fiction author Isaac Asimov who is the father of the  Three Laws of Robotics:
1: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2: A robot must obey any orders given to it by human beings, except where such orders would conflict with the First Law.
3: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

This robot stands about 1 Honda Asimometer tall, it looks humanoid, and is capped by a spaceman helmet with a black visor. Most remarkable about the Asimo is not its appearance, but the way it moves. It lifts off with one foot, sways its hip to maintain its center of gravity, and through a controlled fall, arrested by its lifted foot, it advances towards a goal. In short, it walks like a human. When one imagines a robot moving, stiff movements are the result. One leg lifts, extends, lowers, pauses, followed by the other. Asimo has sensors to calculate its center of balance and velocity, and knows how to move just like humans do, with a casual stride. This is remarkable to see in action like when he climes the stair or runs like a human. Our colleague not just watched the robot but also the people watching the show and wasn’t surprised that some of the them showed misty eyes from emotion.
Wow, it’s like the Grand Canyon, nothing can prepare you for the actuel real  thing!

Thank you Honda  and please, please, please show us more!

Posted in Post Embedded, Uncategorized | Tagged , , , | Leave a comment

Arduino mega and the LOL shield

I purchased the LOL shield because I need it for a simple¬†demonstration. I’m going to use the Arduino mega 1280 to display the numbers 0 to 9 on the LOL shield. That is not difficult to do, but I am also going to use a remote control to send a number to the Mega. That number should be left out of the sequence 0-9 that is displayed by the LOL shield. The fun part of the¬†demonstration¬†is an inspection camera that is used to ‘detect’ the missing number. It sounded easy but the problem started with the combination Arduino Mega and LOL shield. The LOL shield works perfectly on the Arduino UNO but it doesn’t work on the Mega. I’m not the only one running into this problem. The video below shows the problem. (No, it’s not me in the video below below, it’s another Arduino user.)

I started looking at the problem and started to eliminate problems. I started of using the simple example that doesn’t use the CharliePlexing library. I replaced the digitalWrite funtions with analogWrite(pin, 0) and analogWrite(pin, 255). This already got be a bit further. Then Gerard, one of my coworkers told me to disable the clock feeding timer 2. This resulted in rewriting the setup() function:


void setup()
{
alloff();
// Disable PWM on 0-13. Block the clock signal to timer2
TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS22);
OCR2A = 0;
OCR2B = 0;
}

I Also updated allof() since the original function only implements the ‘UNO’ way, I needed a few changes because to do it the Mega way::

void alloff() {
// http://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1266009870
// Arduino mega pin magging does not correspond with Arduino UNO
// Pin mapping.
DDRE = DDRE &~ B00111011;
DDRG = DDRG &~ B00100000;
DDRH = DDRH &~ B01111000;
DDRB = DDRB &~ B11110000;
}

These 2 changes allowed me to use digitalWrite() again. The result looks promissing. The next challange is to fix the CharliePlexing library. It doesn’t work with the Mega 1280. The fixes given above should be applied to the CharliePlexing library also. Also a few other fixes are needed since the ATMega1280 is treated as an ATMega328 in the CharliePlexing library and that is not correct. I’ll post my results here.

See ya.

Update 06-02-2011: I ran into a second issue. The LOL shield and the IR library are using the same timer. I need to assign another timer to the IR library ūüė¶

Posted in Post Arduino | Tagged , , , , , | Leave a comment

Automatic live web page slideshow

One day, Rob Valent (Managing Director ATS Benelux) came up with the idea to set up a display in our public lunch area that shows several websites or local announcements. The application had to meet the following requirements:

– A full-screen web browser application
– A configurable list of websites
– A configurable interval for changing the website
– The possibility to add custom pages for announcements.

I did not find anything I liked so I started to write an application based on¬†¬†Nokia’s Qt toolkit (not to be confused with Apple’s QuickTime), which has a WebKit browser included. Qt is the toolkit that is used by most the KDE desktop environment in Linux. It is a cross-platform C++ toolkit/framework which has all kinds of data structures, useful utility classes and an easy way for creating GUI applications. WebKit is the browser engine used by browsers like Google Chrome and Apple’s Safari.

The complete Qt SDK for Windows, Mac OS X and Linux can be downloaded free of charge from http://qt.nokia.com . For this project I have used the LGPL version, but there is also a commercial version available. More info about Qt, manuals for Qt Creator and Qt tutorials can be found at the Qt website.

The sourcecode I created can be downloaded here.

To create the GUI, I have used the Qt Creator IDE included with the Qt SDK. Qt Creator has a GUI designer a code editor and an interface to the build tools and the debugger, which is gcc/g++ on Linux and Mac OS X, MinGW on Windows.

I’ve used the QWebView widget, which essentially is the WebKit browser, as the main widget in the application and a QMenuBar, because a menu bar is the easiest way to access the settings dialog and the shut down button of the application.

For each GUI screen created with the GUI designer, a C++ class is created. In the constructor of the MainWindow class, I read the size of the screen and set the size of the QWebView widget accordingly. This is also where the signals and slots of the different objects are connected. Signals are emitted when a specific event occurs to notify other objects that this event occurred. A slot is a special function in a class, to which a signal can be connected. If that signal occurs, the connected slots are executed. Since slots are functions, they can also be called as a regular function from other functions or classes.

In the MainWindow class, there is a QTimer, a QList of QUrl objects and a QSettings object. The function of the QTimer, QList and QUrl are considered obvious. The QSettings object is more interesting. This is a platform-independent way of storing persistent settings for an application. That’s not very special in itself because that can also be done using an INI file or something similar, but the interesting part is that it does this in the way that is native to the platform it is running on. On Windows it uses the registry, on Linux a file in the home directory and on Mac OS X it uses a property list.
The keyPressEvent function is implemented to make the hiding and unhiding of the menu bar possible. It is called by Qt when a key is pressed, so appropriate action can be taken when the escape or tilde key is pressed. The tilde (~) key is added to make management from an iPhone or Android device possible.

In the Settings dialog, nothing special happens. When the OK button is clicked, the settings are written to the QSettings object and a signal is emitted that the settings have changed. This signal is connected to the MainWindow, so that the settings are applied immediately, by reading them back from the QSettings object in the MainWindow class.

To deploy the software on a Linux or Mac OS X system, there are no prerequisites apart from installing the Qt runtime libraries QtCore, QtGui and QtWebKit using the package manager of choice, i.e. apt-get, MacPorts etc.
To deploy the software on a Windows system, the Qt runtime libraries and the compiler-specific libraries need to be included in the distribution package. The complete list of DLL files required is found in the next screenshot. To show Flash animations, it’s required to install Adobe’s Flash Player for Firefox and Safari.

A Windows distribution package is included with this post. The source is also included, so you can play around with it. Just open the Ticker.pro file using Qt Creator and you can get started.

We have the browser running on a Windows system now. The next challenges are to get it running properly on a Linux based live USB stick or even Freddy’s IGEPv2 board.

Source code can be downloaded here.

Posted in Post Webkit | Tagged , , , , , , , , , , | 4 Comments

Openbricks, an industrial grade Embedded Linux Framework

You really might want to take a look at http://www.openbricks.org If you are in the process of cooking your own linux distro for an ARM platform like the IGEPv2. I am using it to get Geexbox up and running on one of my IGEPv2 boards and Romke is in the process of getting another application up and running with OpenBricks.

Visit http://www.openbricks.org/the-5mn-overview for more information.

Posted in Post Embedded | Tagged , , , , , , , , , | Leave a comment