If you’ve ever looked into low-level parallel port access you may have learned that it only works with actual parallel port hardware, and not with USB parallel port adapters. But here’s a solution that will change your thinking. It borrows from the way printers communicate to allow USB to parallel port bit banging without a microcontroller.
Sure, adding a microcontroller would make this dead simple. All you need to do is program the chip to emulate the printer’s end of the communications scheme. But that’s not the approach taken here. Instead the USB to RS232 (serial) converter also pictured above is used as a reset signal. The strobe pin on the parallel port drives an inverter which triggers a thyristor connected to the busy pin. Thyristors are bistable switches so this solution alone will never clear the busy pin. That’s where the serial connection comes into play. By alternating the data transmitted from the computer between the bit-bang values sent to LP0 and 0xF0 sent to the serial connector the eight parallel data bits become fully addressable. See the project in action in the clip after the break.
We’ve seen a ton of projects that interface hardware with the Raspberry Pi. But they usually depend on bit-banging. That means they toggle the pins in software to match a specific protocol. The thing is that the beefy Broadcom SoC that anchors the board has a lot of built-in peripherals that are just waiting to be used instead of bit banging. In this case, it’s the hardware SPI peripheral which can be accessed via the bcm2835 library for RPi.
One of the things that would have really complicated this process is the pin mapping between the Broadcom chip and the RPi GPIO header. Since not all pins are broken out, it was either luck or good design forethought that made all of the SPI0 pins from the chip available on the RPi breakout header. The library page (linked above) explains this well. But if you’re looking for more of a working example check out [EngineerByNight’s] project with adds an accelerometer using hardware SPI.
[Joe] was experimenting with his Arduino when he started thinking about how he could get it to communicate wirelessly with his Android phone. Bluetooth is an option, but it requires some extra components, and Google’s ADK works as well – just not wirelessly.
Instead, he thought it would be neat to see if he could get the two devices to communicate with a simple magnetic coil. He constructed a small 1cm diameter coil, connecting it to the Arduino via a resistor and diode. Using the Android Tricorder app, he was able to locate his phone’s magnetometer, after which he ran some tests to narrow down the best sample rate and frequency range for communications.
To transfer data between the two devices, he had to bit bang the signal in software, since the Arduino’s UART has a lower limit far faster than the 7 bps data rate he was able to achieve with the magnetometer.
While his wireless Arduino to Android bridge isn’t likely to win any awards for throughput, it is a great proof of concept project. Be sure to check out the video below to see his “poor man’s NFC” in action.
Continue reading “Low-cost, low-bandwidth wireless Arduino to Android communications”
[Mirko] is working on a library that will allow you to add RF control to just about any device. The only requirement is that the device be capable of running a Linux kernel, and that it have a few GPIO pins available. One example is fairly straight forward, a Netgear router. Many, if not most routers run a Linux kernel natively and most have solder points on the board for unused IO pins so patching into the hardware is very straight forward. Less obvious and much more impressive is the hack seen in the image above. [Mirko] built an SD card adapter cable and uses the contacts in the card reader to bit bang four-wire SPI to communicate with that RF module.
It was an interface that launched a thousand hacks. Near trivial to program, enough I/O lines for useful work, and sufficiently fast for a multitude of applications: homebrew logic analyzers, chip programmers, LCD interfaces and LED light shows, to name a few.
Today the parallel printer port is on the brink of extinction (and good riddance, some would say). Largely rendered obsolete by USB, few (if any) new peripherals even include a parallel connector, and today’s shrinking computers — nettops, netbooks, media center PCs — wouldn’t have space for it anyway. That’s great for tidy desks, but not so good if you enjoyed the dirt-cheap hacks that the legacy parallel port made possible.
Fear not, for there’s a viable USB alternative that can resurrect many of these classic hacks! And if you’ve done much work with Arduino, there’s a good chance it’s already lurking in your parts drawer.
Continue reading “Introduction to FTDI bitbang mode”
[Maarten] told us about a C64 USB keyboard that was modified to be used as a standard input device. An interesting aspect of the project is the use of V-USB (formerly known as AVR-USB). V-USB is a software only approach to slow speed USB HID. In essence this is a two fold mod, The C64 keyboard is patched to a PC, and an off the shelf AVR is software-hacked to bit bang the USB communications. The author notes an initial problem with multiple key presses that was later corrected in the application. For the other side of the spectrum, we had covered the C64 twittering client, and a commodore 64 laptop.