Linux Adds CH341 GPIO

There was a time when USB to serial hardware meant one company: FTDI. But today there are quite a few to choose from and one of the most common ones is the WCH CH341. There’s been support for these chips in Linux for a while, but only for use as a communication port. The device actually has RS232, I2C, SPI, and 8 general purpose I/O (GPIO) pins. [ZooBaB] took an out-of-tree driver that exposes the GPIO, and got it working with some frightening-looking CH341 boards.

He had to make a slight mod to the driver to get six GPIOs in /sys/class/gpio. Once there though, it is easy to manipulate the pins using a shell script or anything that can write to the virtual files corresponding to the GPIO pins.

Continue reading “Linux Adds CH341 GPIO”

Blast From The Past With Space Station PROM Reader

The Ursa Major Space Station SST282 is a dinosaur of a digital reverb.  Okay, so maybe 1978 isn’t ancient yet, but it is getting to the point where one has to worry about the possibility of component failure.  At least that’s what [Obsoletetechnology] thought when they created a backup of its memory contents.

As can be seen from some of Hackaday’s previous articles, a part does not have to be an older one to fail.  However, there is no such thing as being too paranoid when it comes to older parts reaching their lifetime.  Especially when there is valuable memory involved.  Each bit of PROM memory is locked by a fuse on its location grid to store permanent data.  To be able to read this and collect the respective data, a Raspberry Pi 3 PROM reader was created.

The SST282 uses 3 TTL-level 74xx series Schottky PROM memories on board that hold RAM lookup tables.  In the case that these failed, all of the subsequent information would be lost since there are no surviving memory dumps online.  Fortunately we are interested only in gathering their contents, so the PROM reader schematic is fairly rudimentary.  The chip’s address and data buses connect to a Pi’s GPIO header, and the only other thing to note is a 74LS541 TTL level shifter that converts the Pi’s 3.3V output to the PROM’s 5V TTL level.

Continue reading “Blast From The Past With Space Station PROM Reader”

Know The Load With This Simple Microcontroller CPU Meter

How do you tell how much load is on a CPU? On a desktop or laptop, the OS usually has some kind of gadget to display the basics. On a microcontroller, though, you’ll have to roll your own CPU load meter with a few parts, some code, and a voltmeter.

We like [Dave Marples]’s simple approach to quantifying something as complex as CPU load. His technique relies on the fact that most embedded controllers are just looping endlessly waiting for something to do. By strategically placing commands that latch an output on while the CPU is busy and then turn it off again when idle, a PWM signal with a duty cycle proportional to the CPU load is created. A voltage divider then scales the maximum output to 1.0 volt, and a capacitor smooths out the signal so the load is represented by a value between 0 and 1 volt. How you display the load is your own choice; [Dave] just used a voltmeter, but anything from an LED strip to some kind of audio feedback would work too.

Still just looking for a load meter for your desktop? Take your pick: an LED matrixold-time meters, or even Dekatrons.

Driving 16 WS2812B Strips With GPIOs And DMA

[Martin Hubáček] wrote in with his WS2812 LED library for the STM32F3 series processors. [Martin]’s library takes the same approach as [Paul Stoffregen]’s OctoWS2811 for the Teensy, and [Erich Styger]’s for the Freescale FRDM-K64F board. That is, it uses three DMA channels to get the signal out as fast as possible.

Continue reading “Driving 16 WS2812B Strips With GPIOs And DMA”

Hand Gestures Play Tetris

There are reports of a Tetris movie with a sizable budget, and with it come a plentiful amount of questions about how that would work. Who would the characters be? What kind of lines would there be to clear? Whatever the answers, we can all still play the classic game in the meantime. And, thanks to some of the engineering students at Cornell, we could play it without using a controller.

This hack comes from [Bruce Land]’s FPGA design course. The group’s game uses a video camera which outputs a standard NTSC signal and also does some filtering to detect the user. From there, the user can move their hands to different regions of the screen, which controls the movement of the Tetris pieces. This information is sent across GPIO to another FPGA which uses that to then play the game.

This game is done entirely in hardware, making it rather unique. All game dynamics including block generation, movement, and boundary conditions are set in hardware and all of the skin recognition is done in hardware as well. Be sure to check out the video of the students playing the game, and if you’re really into hand gesture-driven fun, you aren’t just limited to Tetris, you can also drive a car.

Continue reading “Hand Gestures Play Tetris”

Swapping GPIO Pins On The Pi Zero For Audio

The new Raspberry Pi Zero is generating a lot of discussion, especially along the lines of “why didn’t they include…?” One specific complaint has been that audio is only available through the HDMI port. That’s not entirely true as pointed out by Lady Ada over at Adafruit.

Something to remember about the entire Pi family is the pins on the Broadcom processors are multipurpose. Does it increase the confusion or the capabilities? Take your pick. But the key benefit is that different pins can handle the same purpose. For audio the Greater Than Zero Pis (GTZPi) use PWM0_OUT and PWM1_OUT on the processor’s GPIO pins 40 and 45. On the GRZPis these feed a diode, resistor and capacitor network that ends at the audio output jack. They don’t appear on the GPIO connector so cannot be used on the Zero.

The multi-pin, multi-purpose capability of the Broadcom processor allows you to switch PWM0_OUT to GPIO 18 and PWM1_OUT to GPIO 13 or 19. Add the network from the Adafruit note, or check this schematic from the Raspberry Pi site – look at the lower right on the second page.

raspberry_pi_audiofilter

While you’re checking out the audio hack at Adafruit, read through the entirety of Introducing the Raspberry Pi Zero. Lady Ada provides a great description of the Zero and what is needed to start using it.

If you’re looking for Zero hacking ideas you might check the comments in our announcement about the Zero or article on the first hack we received. There is a lot of grist for the hacking mill in them.

USB2Serial Adapter As An I/O Device

There was a time when computers had parallel ports. For the hacker types, this meant an eight bit data port, and nine additional pins which could be interfaced with the real world via the 25 pin connector. This is no longer the case, although USB does help with suitable hardware. [Jabi] was working on a project that required controlling one relay to switch a strip of LED’s. His solution was to use a USB to Serial Adapter as an I/O device (Spanish, translated here).

He wrote a short C program, SioFus (Simple Input Output from USB2SERIAL), that converts a simple USB to Serial Port Adapter into an I/O device with 4 inputs and 2 outputs. It’s simple and gets the job done. The code uses ioctl and allows DCD, DSR, CTS and RI to act as inputs while DTR and RTS act as outputs. These pins then likely control transistors that switch the relays. The SioFus code is available on github and there are a couple of to-do’s on [Jabi]’s list if you would like to chip in.

The video after the break supposedly shows the hack in action. Seems like some kind of photo booth which then spits out a QR code, possibly a URL to the picture (post in the comments if you figure out what it does).

If you are looking for a more dedicated hardware, check out the Tiny Bit Dingus – a microcontroller stuffed into a USB plug with a few controllable pins.

Continue reading “USB2Serial Adapter As An I/O Device”