Week of programming
Last week Marcel and i took a week of dedicated pidome-ing. In other words, Marcel was dedicated to hardware development, and i was completely focused on programming. And what a week! It may not look as much, but we think a lot has been accomplished.
Last week we managed to create HID based communication and created our own very first PCB.
Marcel has been working on a kind of “driver-less” implementation of USB. This has finally become an HID solution, meaning we can (when there is enough funding etc..) develop usb devices with our own vendor id for use with (but as you will know, not restricted to) the PiDome server. Because it is a general HID implementation every device supporting HID (almost everything), can interface with the hardware and is Arduino based. This solution does not use the RX/TX pins on the chip leaving these free. This means you can talk to the chips directly from USB without the use of an extra USB chip, or create your own.
Testing a HID based device
To test this interface Marcel has designed a piece of hardware he will be using on one of the USB ports of the pi, and has two 220V relay switches and some sensors. These will be used for monitoring energy usage and switching central heating. First tests on a breadboard where successful with a simple java app he got the device switching the relays. Simple commands like “R1T” and “R1F” switches relay number one on and off.
Taking the hardware a step further
We of course do not want only to have breadboard setups and some “puzzled” solder solutions, we want to use PCB’s. So last week Marcel started to get his way around in eagle to develop one. And i must say, not without result! Some of you who have seen this on our Facebook or Twitter page has already seen the result. But if not, below are two pictures of the above setup on a breadboard (left) which resulted in the shown PCB (middle) and finished soldered (right).
The PCB has been soldered, and a picture will be added as soon as possible. As of this moment we are testing the soldered board in the PiDome server more about this later.
We hope to get the code and schematics online as soon as possible.
On the software side i primarily focused on improvements, fixes and creating universal peripheral drivers
The client just had a couple of bug fixes like the positioning of components when the screen resolution is not the default resolution which is 1920*1080. The client does not use scaling, but loads re-sized components. This is especially meant for the raspberry pi to save memory when running the client in 1280*720 resolution. I made some improvements in readability just in case you have a lot of white in your background. Also the client has a tab added to the graphs to show last years history of sensor (or whatever numeric) data.
The server also has a couple of fixes which solves some memory leaks (What took a LOT of time) which caused the server to be killed by the OS and a couple of speed improvements made to the web interface. The web interface still uses cached page data so first time page loading is a little bit slower. Some fixes include in the arduino driver when there is an unexpected USB disconnect and showing the wrong name at favorite devices, Some extra capabilities have also been introduced, and these are mostly low level so there are not a lot of extra features implemented yet. The next features have been added (short global list):
- Database connection pool – speeds up the system,
- Driver auto loading and manual loading – When a peripheral (custom Arduino device) is not recognized a user can select an appropriate driver or XML file,
- A lot of database updates because of driver loading and peripheral resources are not selected anymore based on XML rules and needs to prepare on multiple peripherals which can load the same driver,
- Auto driver loading based on product and vendor id,
- Added yearly data history storage,
- USB hot plug support (load drivers on USB connect as wel as on windows as the raspberry pi)
- All though committed today, but was work in progress, no more use of “/usr/sbin/unbuffer udevadmin monitor” to catch USB connections and disconnects, bu now uses an integrated method (libudev). So no more extra process killing when needed
- An extra web interface page has been added so you now can see which peripheral is attached and loaded with which driver.
- Not finished but started with an Arduino driver which makes it possible to create devices with the web server’s XML editor and a multipurpose HID driver.
As you can see there are a lot of internal improvements and changes, and some external (like the extra webpage) adding and fixes.
I hope to get the common Arduino driver done as soon as possible. With this interface you can attach the Arduino to the USB of the pi (or powered USB hub) and with the online XML editor create a way to control it, or receive data from.
Some interesting libraries
For the people who are interested in this. The download page has some libraries added for you to download:
- I was testing with usb4java, and needed a raspberry pi build for it. This build is now available on the download page.
- I’m busy with HID driver development. But there was no JDK 1.7 version of the hidapi available, there is a 1.8 version for the raspberry pi. So i created a java 1.7 raspberry pi build, this on is also available.
So, this was the update for the last week of pidome-ing. See you all next post!