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 matrix, old-time meters, or even Dekatrons.
[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”
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”
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.
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.
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”
The ESP8266 is an incredible piece of hardware; it’s a WiFi module controllable over a serial port, it’s five freaking dollars, and if that’s not enough, there’s a microcontroller on board. Until there’s a new radio standard, this is the Internet Of Things module.
The most common version of the ESP, the -01 version, only has a 2×4 row of pins for serial, power, configuration, and two lines of GPIO. It’s a shame that module only has two GPIOs, but if you’re good enough with a soldering iron you can get a few more. It took a lot of careful soldering, but [Hugatry] managed to break out two more GPIOs on this tiny module.
According to [Hugatry] a lot of patience to solder those wires onto those tiny pads, but after finishing this little proof of concept he discovered a Russian hacker managed to tap into four extra GPIOs on the ESP8266-01 module (Google Translatrix).
As a proof of concept, it’s great, but there’s more than one ESP module out there. If you’re looking for a cheap WiFi module, check out the ESP-03, -04, or -07; they have nice castellated pins that are exceptionally easy to solder to.
Continue reading “More GPIOs For The ESP8266”
The Raspberry Pi is a great machine to learn the ins and outs of blinking pins, but for doing anything that requires blinking pins fast, you’re better off going with a BeagleBone. This has been the conventional wisdom for years now, and now that the updated Raspberry Pi 2 is out, there’s the expectation that you’ll be able to blink a pin faster. The data are here, and yes, you can.
The method of testing was connecting a PicoScope 5444B to a pin on the GPIO pin and toggling between zero and one as fast as possible. The original test wasn’t very encouraging; Python maxed out at around 70 kHz, Ruby was terrible, and only C with the native library was useful for interesting stuff – 22MHz.
Using the same experimental setup, the Raspberry Pi 2 is about 2 to three times faster. The fastest is still the C native library, topping out at just under 42 MHz. Other languages and libraries are much slower, but the RPi.GPIO Python library stukk sees a 2.5x increase.