23 Apr 19
Usually when writing emulation software for a system like the Game Boy, one makes sure to take as many shortcuts as possible in order to reduce the resources required for the emulation. This has however the unfortunate side-effect that it reduces the overall accuracy of the emulation and with it the compatibility with games on the system. This is the basic reasoning behind projects which seek to abandon simplistic abstractions in favor of cycle-accurate, full compatibility approaches, of which MetroBoy is probably the most extreme one. Instead of abstracting away the hardware, it instead does the emulation at the circuit level. As with such other projects, this means that the emulator requires a lot more CPU cycles to get things just right. On the bright side, one can likely still run this emulator on any modern system. As the MetroBoy author explains, he implemented code in C++ which allowed him to construct circuits in an HDL-style manner, which should theoretically also allow him to generate a Verilog (or VHDL) softcore out of the project. As a demonstration of implementing HDL in C++ it’s decidedly interesting. An approach like this is pretty much the exact opposite of a project like the UltraHLE (ultra high-level emulator) Nintendo 64 emulator, which used the knowledge that Nintendo 64 games are written in C as a first step to creating libraries that the code in the Nintendo 64 ROMs would call instead of the native (Nintendo) libraries. This allowed N64 games to directly run on the target system, with the graphic and system calls translated by UltraHLE into native OS calls, using the 3dfx Glide API for accelerated graphics. While an approach like UltraHLE took allows for the most minimal use of system resources by essentially foregoing emulation completely, for retro systems like the Game Boy where games were implemented in assembly on bare hardware, using this circuit-level emulation ensures that one gets the most accurate match with the original handheld console experience. As a word of caution to those who are now itching to try out MetroBoy, its Github site notes that it currently lacks support for game saves, uses a mixture of original Game Boy (DMG) and Game Boy Advance SP (AGS) hardware that confuses some games and has rather buggy sound support. If playing around with software-defined Game Boy circuits isn’t enough and would like to literally look inside a real Game Boy, the X-ray image from the top of the article is something Chris over at Elektronaut pulled off several years ago.
16 Apr 19
Imagine that you’re starting a project where you need to measure temperature and humidity. That sounds easy in the abstract, but choosing a real device out of many involves digging into seemingly infinite details and trade-offs that come with them. If it’s a low-stakes monitoring project, picking the first sensor that comes to mind might suffice. But when the project aims to control an AC system in an office of temperature-sensitive coders, it pays to take a hard look at the source of all information: the sensor. Continuing a previous article I would like to use that same BMaC project from that article as a way to illustrate how even a couple of greenhorns can figure out how to pick everything from environmental sensors to various actuators, integrating it into a coherent system that in the end actually does what it should. Popularity Isn’t a Good Indicator A major issue when it comes to figuring out which components one needs is that there are a lot of (online) articles, forum posts and other commentary out there by people who are using the same sensors and actuators without ever really questioning why they are using those devices and not others. A good example of this are the DHT11, DHT22, and AM2302 temperature and hygrometer sensors. While very popular and used by everyone and their dog, they come with a whole range of potential issues. This sensor and a number of others were recently compared in a comprehensive test. The findings of that test showed that across six different sensor devices (specifically the DHT22, BME280, SHT71, AM2320, HTU21D and Si7021), the DHT22 performed the worst, with three out of six sensors outright dying over the course of two years. They also showed issues with variability between individual sensors and a lack of long-term stability and reliability. Long-term stability cannot be expected, self-heating is an issue, and there’s no reliable way to detect strong heating or cooling as compared to a failing sensor. Another issue that makes this range of sensors so annoying to work with is that they use their own, proprietary interface and protocol. This protocol is somewhat similar to the 1-wire protocol as invented by Dallas Semiconductor, but uses its own timing system and without the bus-mastering additions. With only its from Chinese translated datasheet to base a library on, one has to raise serious questions about the reliability of any system that includes one of these sensors. In the BMaC project we initially started out with these DHT22 sensors as well. They were cheap and plentiful, and at first glance they seemed to be just fine. Unfortunately the breakout boards we had did not include the proper resistors on the breakout board, so humidity measurements were off by a few percent RH, as we found out later. These sensors, especially including the breakout boards, are rather bulky as well, making them hard to integrate into projects. At some point we came across this MEMS sensor from Bosch, the BME280. It was similar to the BMP180, another quite popular MEMS temperature and relative humidity sensor. The BME280 does pretty much the same, only a bit more accurately, and also adds air pressure measurements. Even better, these sensors on a nifty little breakout board cost little more than the DHT22 boards we’d been using until that point. These Bosch sensors all use either an I2C or SPI bus. This means that one can hook multiple of these sensors to a single I2C bus and communicate with them using an industry-standard protocol. This massively simplifies the sensor code, as it only has to concern itself with reading out the appropriate registers, instead of also the timing and interpretation of the received bits. So in short, these BME280 sensors turned out to be the superior choice for the project. They are much smaller and more accurate, use a standard interface, and make it easy to chain multiple sensors to a single microcontroller and gaining air pressure readings in the process. Devil is in the Details With hygrometers, self-heating can lead to inaccurate results. The act of measuring the temperature simply causes the device itself to heat up. While working on the initial BMaC project, we struggled trying to determine the accuracy of our thermometers, both DHT22s and BME280s, in the absence of some absolute reference sensor. There are plenty of forum and mailing list threads where people note that their BME280 sensor is measuring two degrees higher than it should, or their DHT22’s measurements are completely out of whack. While the latter we unfortunately found out ourselves to be the case for certain breakout boards, the former issue with the BME280 was harder to pin down as being true. Since that time, people including the very same who did the aforementioned hygrometer shootout also did an absolute temperature test of the BME280 and DS18B20 sensors, with the conclusion that there’s no sign of self-heating apparent. Possibly one could induce some level of self-heating in the case of rapid and sustained measurements, but then one would have to wonder about what kind of environment would have a temperature that changes so quickly that one-second temperature updates are necessary. For the BMaC project we used a measuring interval of 30 seconds, which was more than sufficient for general room temperature measurement. Even when we moved to using the BME280 sensors as inputs for the air conditioning control system, we got nice and tight feedback loops between the AC and the temperature response, as can be seen in this image: The blue graph (MemoryLeak) is the temperature reported from the ceiling-mounted BME280 sensor in a meeting room with two AC units, whereas the other two squiggly lines (Großraum 3) were from the same type of sensor setup in the center of a line of three AC units in an open-plan office.  Finally, the sensor readings post-fixed with my name were DHT22-based setups on my desk in that same open-plan office. The sensor setup in the open plan office was also controlling the AC unit’s fan coil unit (FCU) while measuring the temperature in the same space. The difference between the meeting room and general room readings show how different both systems are configured and measure. The original AC controller with a wall-mounted sensor and aggressive heating pattern ramped up the fan quickly, easing off when the target temperature got reached. In comparison, my ceiling-mounted sensor and controller took a more gradual approach, preferring to slowly ramp up the fan speeds in small increments and constantly adjust using the temperature readings from the nearby BME280 sensor. Obviously, for critter comfort, it’s important that such systems are non-obtrusive and – above all – accurate. Time to Actuate Serious Business While playing around with temperature is fine and everything, the real fun starts when one starts manipulating the water valves and other toys that are hidden in the suspended ceilings of office buildings. Changing the fan speed of the FCUs was easy enough – using a 0-10 V DC signal into a header on the original FCU controller board – the valves controlling the flow of hot and cold water (as described in the aforementioned previous article) required a few bits of custom hardware. The valves near the FCUs are usually the linear thermoelectric actuator type, whereby a material inside the valve is heated through resistive heating in order to cause a linear motion. This motion in turns either opens or closes the valve. The ones we came across were made by Honeywell, with the 24 VAC version installed. These look similar to these: This was high stakes hacking. There was every potential that by using the valves in the wrong way, leaving them open for too long, or drawing too much current we could irreparably damage something, or worse: disable the AC system in the entire building. That’s the kind of scenario where you wish that you had paid more attention to a robust system for the actuators. The system that we ended up implementing for the air conditioning valves either used the standard control signal via a relay for whole-floor-section switches, or the 24 VAC supply that was already present on the original valve control line for the FCUs, bypassing the original relay. For the latter we used an industrial Phoenix Contact SPST relay, driven by a Darlington array from an MCP23008  I2C-based GPIO expander. The advantage of this system is that it uses off-the-shelf components that are meant to be used in an industrial setting. By ensuring that especially the mechanical (relay) parts are rated for the conditions in which they are meant to be used (mounted in a stuffy, hot space above a suspended ceiling), failure over time should be unlikely. When One Can Afford to Learn Lessons As the BMaC project (or ‘playing with IoT stuff’ as it was still known back then) kicked off, there was nothing crucial about anything we did. Using DHT22 sensors, only to find out that they weren’t that good was therefore totally okay. As the project escalated from merely making measurements to controlling parts of the building’s systems, it soon became clear that the stakes had risen dramatically. In any project that uses sensors and/or actuators, the need to validate sensor and actuator accuracy and reliability over time is directly linked with the consequences if any of them were to fail. Having inaccurate room temperature measurements displayed on a Grafana dashboard is embarrassing, having a dodgy coffee machine is annoying, having a non-functioning air conditioning system can cost the company thousands of Euros in lost productivity, or worse. This leads to the take-away message of this article; the most essential part of any serious project is to know what the cost of failure is, and how to hard to try to avoid this by picking the right system components.
16 Apr 19
Whether it comes to rescuing people from a cave system or the underground maze of sewers, tunnels and the like that exist underneath any major city, having accurate maps of the area is always crucial to know what the optimal routes are, and what the expected dangers are. The same is true for combat situations, where such maps can mean the difference between the failure or success of a mission. This is why DARPA last year started the Subterranean Challenge, or ‘SubT’ for short. This challenge seeks new approaches to map, navigate, and search underground environments during time-sensitive combat operations or disaster response scenarios, which would allow for these maps to be created on-demand, in the shortest amount of time possible. Multidisciplinary teams from the world are invited to create autonomous systems that can map such subsurface networks no matter the circumstances. The competition has a ‘systems track’, which has teams developing physical systems that can perform their intended function in a physical environment, ranging from tunnels, urban underground to cave systems. The next qualification deadline is April 22, 2019, for the Tunnel Circuit in August. In addition to the systems track, there’s also a software-only Virtual competition, which requires that algorithms and similar are developed which can successfully map a virtual environment. Both the systems and virtual tracks will have the final challenge day in 2021. Also see the attached video trailer DARPA offers for this challenge. If none of this tickles your fancy, there are also the US Government’s ‘Challenge’ website, which collects a range of challenges offered by government agencies, often for monetary awards.  
12 Apr 19
Market Research Nest

MarketResearchNest.com adds “Global Wood Splitter Market Insights, Forecast to 2025” new report to its research database. The report spread across 121 pages with multiple tables and figures in it. The Wood Splitter market was valued at Million US$ in 2018 and is projected to reach Million US$ by 2025, at a CAGR of during the […]

09 Apr 19
The increase in network-connected devices the past years has been something of a dual-edged sword. While on one hand it’s really nice to have an easy and straight-forward method to have devices talk with each other, this also comes with a whole host of complications, mostly related to reliability and security. With WiFi, integrating new devices into the network is much trickier than with Ethernet or CAN, and security (e.g. WPA and TLS) isn’t optional any more, because physical access to the network fabric can no longer be restricted. Add to this reliability issues due to interference from nearby competing WiFi networks and other sources of electromagnetic noise, and things get fairly complicated already before considering which top-layer communication protocol one should use. In this article we’ll be looking at implementing such a network-based system, securing a WiFi network with TLS, and the use of MQTT in combination with a proxy. I’ll illustrate this using experiences and lessons learned while working on this Building Management and Control (BMaC) project that I covered in a previous article. Getting MQTT into your system Message Queuing Telemetry Transport (MQTT) is a small, binary protocol that was developed by Andy Stanford-Clark of IBM and Arlen Nipper of Cirrus Link in 1999. Its version 3.1 was submitted in 2013 IBM to OASIS for standardization. Another version of MQTT is MQTT-SN, which is designed for lower-bandwidth, non-TCP networks, such as Zigbee, UDP and Bluetooth. Due to its compact size and simple, client-server architecture, it is highly suitable for connecting larger and smaller networks of sensors, especially in high-latency, low bandwidth situations. It uses a subscribe-publish model, where clients can subscribe to topics on which others can publish messages. These messages can be persistent, have guaranteed delivery and (as of version 5) can automatically expire if they cannot be delivered. The obvious advantage of MQTT is that it supports everything from always-online, high-bandwidth clients, to low-powered, remote sensor nodes which just wake up every week, dial into a satellite link and send some sensor readings while updating their calibration settings from data which they receive at the same time from some other client. The use of MQTT (with the Mosquitto MQTT broker) in the BMaC project was initially more of a coincidence, with us using it mostly because an MQTT client was already integrated into the framework we were using on the microcontrollers. None of us had really thought about the advantages or disadvantages of MQTT over any alternatives. Now, years later, it’s easy to see why MQTT was the right choice. While running it on an internal, TCP-based network, we got the guaranteed delivery aspect of TCP along with its built-in checksum verification, with the MQTT protocol itself putting no constraints on the payload it can carry, whether it be text-based or binary. Real competition for MQTT does not really exist. AMQP is also fairly popular, but it targets desktop and server systems in an enterprise setting, and doesn’t really scale down to RAM-constrained 8-bit microcontrollers. Further, AMQP also defines an encoding scheme for the payload, whereas MQTT leaves one free to use whichever encoding or serialization scheme one wishes to use. With BMaC we could thus develop our own payload format that would be sent to and from the ESP8266-based nodes. This resulted in a compact, binary format using just a few bytes at most that sufficed to configure nodes over MQTT as well as adjust the fan and relay settings. Securing the System The best way to secure a system is through the practice of security in depth. That means that every part that could be exploited should be secured in some fashion. Assuming a system like that of BMaC, this means that the physical hardware is all inside an office building, which has its own security system installed. This security system can be simple mechanical locks, or some NFC tag-based system. Sensitive areas like server rooms require their own access keys or permissions associated with the NFC tags. This practically eliminates any risk of unauthorized individuals gaining access to the hardware, let alone perform any nefarious actions. Wireless networks for a system like this are of course secured by WPA2 or similar, meaning that without the right password or certificate, one cannot connect to the wireless network. Any traffic on the network will consequently be encrypted. This shifts the most likely threat to those who somehow have gained access to the network, whether through legal means, or because the WiFi SSID and password were in a photograph that got published on the public company blog (true story). At this point we have an okay level of security, but the missing ingredient is to secure the traffic between the nodes and the backend servers, meaning either TLS encryption (very common), or Elliptic Curve Cryptography (ECC), which would be the superior choice because it’s faster, requires significantly less RAM, and has much smaller certificates. Unfortunately ECC has taken the backseat to TLS, mostly on account of it being patent-encumbered for much longer. This made TLS the easier type to integrate into the BMaC project, as adding ECC would have meant ditching the axTLS library in the framework which we were using for the ESP8266 nodes and integrating an alternate library that supports ECC and also fits in the limited RAM provided by this microcontroller. The Part Where Things go Boom We quickly found out that the default handshake setting in TLS encryption for TCP connections causes massive problems for an ESP8266 and similar MCUs which tend to have less than 30 kB of SRAM available when this handshake event occurs. The default TLS configuration dictates namely that the maximum TX/RX buffer sizes are allocated when a secure connection is attempted, being 16 kB each, or 32 kB in total. With non-trivial firmware this results in the MCU running out of memory and the MCU resetting. Fortunately this setting can be changed on the side of the server, as noted in this article on TLS. This would allow the server to set the TLS buffer size to something that would fit in the MCU’s SRAM. Sadly for BMaC, the server on the Mosquitto MQTT broker didn’t have this as a configuration setting, requiring us to change it in the source code and recompile the server. That seemed a bit of overkill. Instead we opted to add a different TLS endpoint to the system, using HAProxy as an intermediate. We configured an interface with TLS-only access that simply routes any decrypted data to Mosquitto via the localhost loopback interface, and set the tune.ssl.maxrecord property to 2 kB, for 4 kB of buffer space on the ESP8266. After enabling both server and client certificates on the HAProxy and BMaC node firmware respectively, we had a TLS-encrypted connection up and running, ensuring that not even our colleagues could sniff on what we were doing. Putting it Together By the time we had finished wiring up the first controller for the air conditioning system at the office, the BMaC project consisted out of a wireless network of motion, temperature, CO2, air pressure and coffee usage sensors, along with a bunch of relays and fan controllers, all tied together using a central backend server and secure MQTT connections.. After getting the network set up, with MQTT secured using client-side certificates to make sure that only genuine BMaC MQTT clients could connect, it was very nice to be able to focus on getting the commands and data transferred between the nodes and the backend. The only issue that really annoyed me there was the lack of an MQTT desktop client that would allow me to do MQTT monitoring, active topic discovery and be directly compatible with binary payloads instead of assuming that one would only ever use MQTT for text-based payloads. This led to me developing a C++/Qt-based MQTT desktop client called MQTTCute. It’s the client I wish I would have had right from the beginning as I was setting up the whole system, trying to get an idea of what was being sent around on the MQTT topics. Since we ended up using a binary protocol for BMaC, having a built-in hex view function in the desktop client would have been invaluable. Regardless, if we had to do it all again, with the knowledge we gained, we would pretty much still have picked the same route. Likely we would try to use ECC instead of TLS, however, just to save ourselves the overhead of using an additional TLS endpoint and proxy server. We also found that a number of MQTT libraries assumed text-based payloads, and would use C functions like strlen() and kin. Many of them have since received pull requests from yours truly so that those libraries now happily accept any kind of binary data one wishes to send via MQTT, including images. The Elephant in the Room When it comes to MQTT and similar client-broker systems, there’s always the argument that they cannot be reliable because they have a single point of failure in the form of the MQTT broker. This is definitely a valid point, but also not nearly as valid as one might assume. MQTT brokers tend to run on reliable server hardware, in the case of BMaC as a Linux virtual machine instance on a storage cluster. For the broker to suddenly vanish off the network would require the kind of catastrophic failure that’d cripple the company’s network along with it. One could conceivably set up a second, fall-over MQTT broker on a secondary address, but that would be a lot of work without good cause. In our own year-long BMaC development process, we had zero failures of the Mosquitto broker and more issues with glitches in the (old) WiFi access points.
08 Apr 19

SANDSIV, the leading customer experience management (CXM) enterprise software provider, proudly announces that one of Europe’s largest telecom firms has chosen sandsiv+ to integrate and automate its customer intelligence ecosystem. A1 Telekom Austria Group joins a large roster of international businesses, including Fastweb, Lufthansa Group, Axa, Vodafone and Iberdrola, who benefit from sandsiv+’s comprehensive feedback-collection […]

08 Apr 19
Parlay Game

The 2018-2019 Champions League is warming up as the competition heads for the quarter-finals. The competition of leading clubs in Europe has slightly different sensation The tournament's overall schedule is the same, the qualifiers were held in June, July and August, two months ahead of the group stage, which began in September. The last 16 […]

04 Apr 19
Samerberger Nachrichten

Kann eine Frau Gott näher sein als jeder Mann? Kann sie Visionen empfangen, wie sie keinem Mann je zuteil geworden sind? Unmöglich. Nicht nur in der patriarchalischen Welt des Mittelalters. Was genau steckt hinter dem Mysterium von Hildegard von Bingen?  Mit einer neuen Produktion ist am Freitag, 10. Mai um 20 Uhr die „theaterlust..“ aus […]

02 Apr 19
Mardi Gras Magazine

Krewe Des Amis Creates A Party Playlist Krewe Des Amis celebrated its 39th year on Saturday, February 16 in the Lake Charles Civic Center Coliseum. The theme for this year’s ball was “Krewe Des Amis Creates A Party Playlist.” The venue was transformed that night for Krewe members and guests to celebrate this year’s Mardi […]

01 Apr 19

Bert Habets has resigned as CEO of European media giant RTL, which has appointed Thomas Rabe to take over the role. RTL said Habets has stepped down as chief executive and also from the board of RTL. Rabe told Reuters that Habets was leaving for family reasons and that there were no disagreements over strategy. […]

27 Mar 19
The Charger

With a larger team, including five newcomers and five returning All-Americans, coach Cheryl Lewis looks forward to a exciting season. “I’m very excited for our stunting possibilities as well as our continued growth as cheerleaders and dancers,” Lewis said. Along with the growth and possibilities, Lewis said she was looking forward to the new and […]

27 Mar 19
NeHi Stripes Musiczine

The power and soul of the Seattle Music made itself known in full force.

28 Mar 19
Eli Effinger-Weintraub

At Paganicon 2019, I had the honor of sitting on a panel on Atheist Paganism, alongside organizer/moderator Kay Lara Schoenwetter, Godless Paganism editor John Halstead, and local Pagan luminary, thinker, writer, and raconteur Steven Posch. Kay sent us questions beforehand, and like any good public speaker with anxiety, I wrote out and relentlessly practiced my answers beforehand. […]