Firmware Factory: Bit Fields vs Shift and Mask

Working with embedded systems usually involves writing code which will interface with hardware. This often means working on the register level. It doesn’t matter if we’re talking about a UART, an analog to digital converter, an LCD controller, or some other gizmo. Sooner or later, you’re going to have to break out the datasheets and figure out how to talk to an external device. To succeed at this you must become a master of bit manipulation.

Hardware designers don’t like wasting space, so modes, settings and other small pieces of information are often stored as packed bits. Our processors usually access things a byte (or a word) at a time, so what is the best way to handle this? Like so many other topics in software engineering, there are multiple ways to skin this cat. In C (and its derivatives) there are two major options: shift and mask, and bit fields.

Continue reading “Firmware Factory: Bit Fields vs Shift and Mask”

New Version of Raspberry Pi Thin Client

It is funny how many times you use your full-blown PC as a terminal to another computer (which is quite often not as capable as the terminal computer). If all you need is a remote display and keyboard, a Raspberry PI would be enough. One of the newer Pi 2 boards would be even better.

You could roll your own set of remote access software, but you don’t have to. [Gibbio] has already created a thin client image called RPiTC and recently released version 1.4. The build supports diverse remote protocols including Microsoft Remote Desktop, Citrix, VMWare, and even X3270.

It supports WiFi and VPN. We were a little disappointed that it didn’t seem to have any serial communication programs (in case we wanted to build one into an old TeleType case). Of course, it is just a Linux system so you can install anything you want or need.

Continue reading “New Version of Raspberry Pi Thin Client”

Combining Musical Hatred with Target Practice

Not everyone can agree on what good music is, but in some cases you’ll find that just about everyone can agree on what is awful. That’s what the people over at Neo-Pangea discovered when they were listening to Internet radio. When one of those terrible songs hits their collective eardrums, the group’s rage increases and they just need to skip the track.

This is how Engineers act if the song is super-awful
This is how Engineers act if the song is super-awful

Rather than use a web app or simple push button to do the trick, they turned the “skip” button into a NERF target. They call their creation the Boom Box Blaster and made a fantastic demo film video about it which is found after the break.

Inspired by a painting in the office, the target takes the form of a small hot air balloon. The target obviously needed some kind of sensor that can detect when it is hit by a NERF dart. The group tried several different sensor types, but eventually settled on a medium vibration sensor. This sensor is connected to an Arduino, which then communicates with a Raspberry Pi over a Serial connection. The Pi uses a Python script to monitor the Arduino’s vibration sensor. The system also includes some orange LEDs to simulate flames and a servo attached to the string which suspends the balloon from the ceiling. Whenever a hit is registered, the flames light up and the balloon raises into the air to indicate that the shot was on target.

Continue reading “Combining Musical Hatred with Target Practice”

Bread Online is a Bread Maker for the Internet of Things

An engineering student at the University of Western Macedonia has just added another appliance to the ever-growing list of Internet enabled things. [Panagiotis] decided to modify an off-the-shelf bread maker to enable remote control via the Internet.

[Panagiotis] had to remove pretty much all of the original control circuitry for this device. The original controller was replaced with an Arduino Uno R3 and an Ethernet shield. The temperature sensor also needed to be replaced, since [Panagiotis] could not find any official documentation describing the specifications of the original. Luckily, the heating element and mixer motor were able to be re-used.

A few holes were drilled into the case to make room for the Ethernet connector as well as a USB connector. Two relays were used to allow the Arduino to switch the heating element and mixer motor on and off. The front panel of the bread maker came with a simple LCD screen and a few control buttons. Rather than let those go to waste, they were also wired into the Arduino.

The Arduino bread maker can be controlled via a web site that runs on a separate server. The website is coded with PHP and runs on Apache. It has a simple interface that allows the user to specify several settings including how much bread is being cooked as well as the desired darkness of the bread. The user can then schedule the bread maker to start. Bread Online also comes with an “offline” mode so that it can be used locally without the need for a computer or web browser. Be sure to check out the video demonstration below. Continue reading “Bread Online is a Bread Maker for the Internet of Things”

Reverse Engineering how a USB Switch Switches

[Daniel] found himself with a need to connect a single USB device to two Linux servers. After searching around, he managed to find an inexpensive USB switch designed to do just that. He noticed that the product description mentioned nothing about Linux support, but he figured it couldn’t be that hard to make it work.

[Daniel] started by plugging the device into a Windows PC for testing. Windows detected the device and installed an HID driver automatically.  The next step was to install the control software on the Windows system. This provided [Daniel] with a tray icon and a “switch” function. Clicking this button disconnected the HID device from the Windows PC and connected the actual USB device on the other side of the USB switch. The second computer would now have access to the HID device instead.

[Daniel] fired up a program called SnoopyPro. This software is used to inspect USB traffic. [Daniel] noticed that a single message repeated itself until he pressed the “switch” button. At that time, a final message was sent and the HID device disconnected.

Now it was time to get cracking on Linux. [Daniel] hooked up the switch to a Linux system and configured a udev rule to ensure that it always showed up as /dev/usbswitch. He then wrote a python script to write the captured data to the usbswitch device. It was that simple. The device switched over as expected. So much for having no Linux support!

Hacking An Android Laptop To Run Linux

A few years ago, someone at Lenovo realized they could take an Android tablet, add a keyboard, and sell a cheap netbook that’s slightly more useful than a YouTube and Facebook machine. Since then, Lenovo has stopped making the A10 notebook and has moved on to manufacturing Chromebooks. That doesn’t mean this little Laptop doesn’t have some life left in it: it still has a Cortex A9 Quad core CPU, is reasonably priced on the ‘defective’ market, and can now run a full-blown Linux.

When the A10 notebook was released, there was a statement going around saying it was impossible to install Linux on it. For [Steffen] that was a challenge. He cracked open this netbook and took a look around the Flash chips. There were two tiny pads that could be shorted to put the device in recovery mode, and the entire thing can be booted from a USB stick.

[Steffen] ran into a problem while putting a new kernel on the netbook: there was a null pointer reference in some device during boot. The usual way of diagnosing this problem is to look at the console to see what device failed. This netbook doesn’t have a UART, though, and [Steffen] had to use an FTDI chip and set the console to USB to see why this device failed.

Just about everything on this tiny laptop works right now, with a few problems with WiFi, webcam, and standby mode – all normal stuff for a putting Linux on a random machine. It’s worth it, though: the quad-core ARM is a very good chip, and [Steffen] is running x86 apps with qemu. Not bad for something that can be found very, very cheap.

Hacklet 50 – Hydroponic Projects

Growing plants without soil has been has been amazing people for centuries. First written about in the 1600’s, hydroponics has become an industry with numerous techniques for germinating and sustaining both plant and animal life. It comes as no surprise then that hackers, makers, engineers, and scientists have been working with and improving hydroponic systems for centuries. Hydroponic plant growth is a project you can really sink your teeth into, as there’s nothing sweeter than eating the fruits and vegetables of your labor. This week’s Hacklet is all about the best hydroponic projects on Hackaday.io!

hydropwnWe start with HydroPWNics, [Adam Vadala-Roth’s] entry in The 2015 Hackaday Prize. [Adam] is creating a universal system with will work with both hydroponic and soil based grow systems. The hydroponic setup will consist of plants in a PVC gutter system. Water will be pumped to the top gutter, and flow down via gravity through the plant roots and back to the reservoir. The system will be monitored and controlled by a DyIO controller. Props to [mad.hephaestus] for creating DyIO, a project seeing reuse in the Hackaday.io community!

 

hydro2Next up is [Justin] with AAGriculture, an Automated Aquaponic Garden. AAGriculture is aquaponic system, which means it uses a symbiotic relationship between plants and fish to make more food for humans to eat. The fish in this case are bluegill and bullhead. A Raspberry Pi controls the system, while A Teensy-LC is used to help out with some of the real-time duties, like monitoring a PH probe. [Justin] is even using CO2 tanks to keep dissolved gasses in check. He must be doing something right, as his tomatoes are now over 23″ tall!

 

homer[Em] brings us 5g Aquaponics. 5g aquaponics isn’t a next generation cellular system, nor a 5.8 GHz WiFi setup, it’s an aquaponic system in a 5 Gallon bucket. Anyone from the US  will recognize the orange “Homer Bucket” from Home Depot. 5g Aquaponics includes a window, allowing the underwater workings to be monitored. Speaking of monitoring, 5g aquaponics is a manual affair – [Em] hasn’t used any electronics here. The idea is to create a system that is easy to get up and running for those who are new to Hydro/Aquaponic setups. [Em] is using a dual zone root system. The plant grows in dirt within a burlap fabric. The fabric then sits in a water bath which also houses the fish. Air pumped through an airstone keeps everything circulating. [Em’s] initial version of the project worked a bit too well. The tomato plant grew so large that the roots strangled the fish! Hopefully both flora and fauna are happy with this new rev 2.0!

 

smartAquaFinally we have [Kijani grows] with Smart Aquaponics, which was [Kijani’s] entry in The 2014 Hackaday Prize. One wouldn’t expect fish, plants and Linux to mix, but that is exactly what is going on here. Linux runs on the popular Wr703n router, while a custom ATmega328 Arduino compatible board keeps track of the sensors.  The second version of the system will run on an ATmega2560 and an AR9331 module, all housed on one board. The system does work, and it’s been expanded from a single fish tank to a large flood/drain table complete with grow lights, all kept at [Kijani’s] office. The biggest problems [Kijani] has run into are little things like misplaced resistors masquerading as kernel bugs.

Still haven’t eaten your veggies? Want to see more hydroponic projects? Check out our new hydroponic projects list! That’s it for this week’s Hacklet, As always, see you next week. Same hack time, same hack channel, bringing you the best of Hackaday.io!