Give Your Raspberry Pi SD Card A Break: Log To RAM

The fragility of SD cards is the weak link in the Raspberry Pi ecosystem. Most of us seem to have at least one Pi tucked away somewhere, running a Magic Mirror, driving security cameras, or even taking care of a media library. But chances are, that Pi is writing lots and lots of log files. Logging is good — it helps when tracking down issues — but uncontrolled logging can lead to problems down the road with the Pi’s SD card.

[Erich Styger] has a neat way to avoid SD card logging issues on Raspberry Pi, he calls it a solution to reduce “thrashing” of the SD card. The problem is that flash memory segments wear out after a fairly low number of erase cycles, and the SD card’s wear-leveling algorithm will eventually cordon off enough of the card to cause file system issues. His “Log2Ram” is a simple Unix shell script that sets up a mount point for logging in RAM rather than on the SD card.

The idea is that any application or service sending log entries to /var/log will actually be writing them to virtual log files, which won’t rack up any activity on the SD card. Every hour, a cron job sweeps the virtual logs out to the SD card, greatly reducing its wear. There’s still a chance to lose logging data before it’s swept to disk, but if you have relatively stable system it’s a small price to pay for the long-term health of a Pi that’s out of sight and out of mind.

One thing we really like about [Erich]’s project is that it’s a great example of shell scripting and Linux admin concepts. If you need more information on such things, check out [Al Williams’] Linux-Fu series. It goes back quite a way, so settle in for some good binge reading.

Farming Items With RasPi-Modified Joycons

The Pokémon games have delighted legions of Nintendo gamers over the years, and show no signs of slowing down any time soon. Despite its popularity, there are certain aspects of the games that are unarguably about simply grinding your way to success. For [Mori Bellamy], this simply wouldn’t do – yet their thirst for gold bottlecaps was insatiable. What to do? Automate it, of course.

The first step was to hack the Joycons from the Nintendo Switch. A DG333A analog switch IC was hooked up to the buttons inside, and controlled by the GPIO pins of a Raspberry PI. The joystick was then controlled with an MCP4725 DAC, allowing the system to fully emulate control inputs to the console.

With the console now under control by the Raspberry Pi, the next step was to add intelligence. Google’s Tesseract OCR platform was combined with a helping of Python code. This allows the script to read dialog boxes from the game, and use this data to determine which buttons to press to farm items.

[Mori] has provided the code on GitHub for others to use, noting that it should be generalizable to other games with a little work. Fundamentally, the underlying hardware could readily be repurposed to other controllers, too. There’s plenty of other ways to automate the drudgery of gaming, even if you have to use a touch screen. Video after the break.

Continue reading “Farming Items With RasPi-Modified Joycons”

Hackaday Links Column Banner

Hackaday Links: March 31, 2019

You can now make flexible circuit boards of unlimited length. Trackwise was contracted out for making a wiring harness for the wing of a UAV and managed to ship a 26 meter long flexible printed circuit board. This is an interesting application of the technology — UAVs are very weight sensitive and wiring harnesses are heavy. Wings are straight, but they flex, and you need wires going from tip to tip. Flex circuits do all of this well, but first you need a technology that allows you to manufacture circuits that are as long as a wing. This is apparently something called ‘reel-to-reel’ technology, or some variant of continuous production. Either way, it’s cool, and we’re wondering what else this kind of circuit enables.

You may have noticed a few odd-shaped buildings going up in the last few years. These are buildings designed for indoor skydiving. Two went up around DC in the last year or so. What if you didn’t need a building? What if you could make an outdoor, vertical wind tunnel? Here you go, it’s the Aerodium Peryton.

KiCon, the first and largest gathering of hardware developers using KiCad, is happening April 26th in Chicago.

If KiCad isn’t your thing, PyCon is in Cleveland May 1-9. It couldn’t come at a better time: after losing LeBron, the Cleveland economy has plummeted 90%. Cleveland needs an industry now, and tech conferences are where it’s at. Go Browns.

For one reason or another, a few tech blogs wrote about a product on Tindie last week. It’s the SnapOnAir Raspberry Pi Zero PCB. This turns a Raspberry Pi Zero into a tiny, battery-powered handheld computer with a keyboard and display. This is just a PCB, and you’ll need to bring your own switches, display, and other various modules, but it is a compact device and if you need a small, handheld Linux thing, this is a pretty good solution.

Oh noes April Fools is tomorrow, which means the Internet will be terrible. Tip ‘o the hat to Redbox, though: they were the only one that sent out a press release to their waste of electrons by last Friday.

 

A Weather Station Fit For A PDP-11

The Digital Equipment Corp. PDP-11/70 is a masterpiece of Cold War-era industrial design. This microcomputer was the size of one or two modern server racks depending on configuration, and the front panel, loaded up with blinkenlights, was clad in a beautiful rose and magenta color scheme. The switches — the ones you used to toggle bits in memory — were actually custom designed covers made to match the shape of the completely unnecessary bezel. The aesthetic of the 11/70 is the intersection of baroque and modernism on the design Venn diagram.

[Oscar Vermeulen] built a miniature version of the PDP-11/70 that houses a Raspberry Pi, and [rricharz] has been hard at work bringing an original copy of BSD to this system. The first great project to come out of this effort? It’s a weather station, and it’s exactly as cool as you think it is.

A bit of ground work went into this build, including getting a historical Unix system up and running, in this case 2.11 BSD. Armed with a Pi and the PiDP-11/70 front panel, [rricharz] had a complete BSD system up and running, and with cool-retro-term, the interface looked the part. Doing something useful was another question entirely, but the Pi in the PiDP had some GPIOs free, so this ancient machine got an I2C temperature and pressure sensor.

The completed build is basically just a breadboard, a tiny diagnostic OLED, and a python script that grabs the data and sends it over to the sim. This is pressure and temperature data shoved into an emulation of a Tektronix 4010 terminal. It’s marginally useful work done by an ancient BSD system wrapped in an emulation on a Raspberry Pi. It doesn’t get better than that.

An Air Quality Monitor That Leverages The Cloud

Air quality has become an increasing concern in many urban areas, due to congestion and our ever-increasing energy use. While there are many organisations that task themselves with monitoring such data, it’s also something anyone should be able to take on  at home. [Chrisys] is doing just that, with some impressive logging to boot.

The build starts with a Raspberry Pi Zero W, which offers the requisite computing power and Internet connectivity in a compact low-power package. For determining air quality, the Bosch BME680 sensor is used. This offers temperature, pressure, and humidity readings, along with the ability to sense the presence of volatile organic compounds, or VOCs. These can be harmful to human health, so it’s useful to have an idea of the levels in your home.

The hardware is incredibly refined. It’s simple enough for the newbie, but just begs for the more experienced hacker to expand on.

On the software side, data is accessible through the Balena cloud service. Sensor readings are stored in an InfluxDB instance, with Grafana providing the visually attractive graphs and monitoring. It’s all very slick and Web 2.0, and can be accessed from anywhere through a web browser.

The project is a great example of combining a basic DIY Raspberry Pi setup with the right software tools to create a polished and effective end product. Of course, if you’re looking for something more portable, this project might be more your style. 

Here’s The First Person To Put A Pi In The Raspberry Pi Keyboard

Last week, the Raspberry Pi foundation released the first official Raspberry Pi-branded keyboard and mouse. As a keyboard, it’s probably pretty great; it’s clad in a raspberry and white color scheme, the meta key is the Pi logo, there are function keys. Sure, the Ctrl and Caps Lock keys are in their usual, modern, incorrect positions (each day we stray further from God’s light) but there’s also a built-in USB hub. Everything balances out, I guess.

The Pi keyboard started shipping this week, and it took two days for someone to put a Pi zero inside. Here’s how you do it, and here’s how you turn a Pi keyboard into a home computer, like a speccy or C64.

The parts required for this build include the official Pi keyboard, a Pi Zero W, an Adafruit Powerboost, which is basically the circuitry inside a USB power bank, and a LiPo battery. The project starts by disassembling the keyboard with a spudger, screwdriver, or other small wedge-type tool, disconnecting the keyboard’s ribbon cables, and carefully shaving down the injection molded webbing that adds strength to the keyboard’s enclosure. The project is wrapped up by drilling holes for a power LED, a button to turn the Pi on and off, and the holes for the USB and HDMI ports.

One shortcoming of this build is the use of a male-to-male USB cable to connect the keyboard half of the circuitry to the Pi. This can be worked around by simply soldering a few pieces of magnet wire from the USB port on the Pi to the USB input on the USB hub. But hey, doing it this way gives the Official Pi keyboard a convenient carrying handle, and when one of the ports breaks you’ll be able to do it the right way the second time. Great work.

Raspberry Pi Tracks Humans, Blasts Them With Heat Rays

Given how long humans have been warming themselves up, you’d think we would have worked out all the kinks by now. But even with central heating, and indeed sometimes because of it, some places we frequent just aren’t that cozy. In such cases, it often pays to heat the person, not the room, but that can be awkward, to say the least.

Hacking polymath [Matthias Wandel] worked out a solution to his cold shop with this target-tracking infrared heater. The heater is one of those radiant deals with the parabolic dish, and as anyone who’s walked past one on demo in Costco knows, they throw a lot of heat in a very narrow beam. [Matthias] leveraged a previous project that he whipped up for offline surveillance as the core of the project. Running on a Raspberry Pi with a camera, the custom software analyzes images and locates motion across the width of a frame. That drives a stepper that swivels a platform for the heater. The video below shows the build and the successful tests; however, fans of [Matthias] should prepare themselves for a shock as he very nearly purchases a lazy susan to serve as the base for the heater rather than building one.

We’re never disappointed by [Matthias]’ videos, and we’re always impressed by his range as a hacker. From DIY power tools to wooden logic circuits to his recent Lego chocolate engraver, he always finds ways to make things interesting.

Continue reading “Raspberry Pi Tracks Humans, Blasts Them With Heat Rays”