Category Archives: electronics

Introducing Media Circus

Media Circus is a scrolling marquee that displays amusing headline news mashups.

Although this project is not quite finished, it’s at a point where I can show it: what’s missing is the ability of the unit to automatically update the headlines (once every hour). Currently, this appliance needs to be manually updated.

Cutup

Media Circus Concept Drawing

Media Circus is composed of several modules, starting with “Cutup”, a mashup generator which is a php script that retrieves rss headlines from two Canadian news services, recombines them and displays 20 of them in HTML format. This isn’t by any means a new concept: it’s actually an old dadaist party game. William Burroughs used cutups in his writing. Visit Publicassemblage, runme.org, and Cut-up Machine for more online examples of this technique.

From this list, a human operator chooses one or two and makes minor edits to prepare them for inclusion in the unit. For the time being, I’m the ‘human operator’, and my choices are regularly uploaded to the ‘generalxcentric’ Twitter feed. I use Hootsuite to schedule the tweets throughout the day.

I’ll be building Cutups for the USA and the UK, and in the more distant future, provide a Media Circus mobile app that will enable users to generate their own news headline mashups!

The Hardware

The marquee runs on an Arduino Duemilanove (ATMEGA328 microcontroller). Power is supplied by an LM317T adjustable voltage regulator configured to output 5v. The regulator delivers up to 1.5 amps current, more than enough to drive the four SURE 0832 displays, but you must attach a heatsink—the regulator gets very hot.

I specify the ATMEGA328 because it has 2k of internal SRAM memory, and in the case of this application, it’s important. This microprocessor has three types of random access memory:

  • 32k Flash memory, of which about 2k is used by the Arduino bootloader.
  • 2k SRAM (Static ram), which is used to hold variables created by the program at runtime
  • 1k EEPROM memory, available using the PROGMEM function

The Flash memory is the same technology used in USB thumb drives. It is relatively slow to write to and reasonably fast to read from. It’s non-volatile, which means that it doesn’t lose data if power is removed. The 2k SRAM (Static Random Access Memory) is used for temporary storage of variables. It’s fast with both reading and writing, but it’s volatile. The EEPROM (Electrically-erasable Programmable Read-Only Memory) is also volatile, and it is very slow to write to, and fast to read from. The Arduino IDE does not have a function to make use of this memory. If you need it, you have to load the avr/prgmspace.h library and invoke PROGMEM.

For the purposes of this application, I quickly ran into the 2k SRAM limit, for two reasons:

  1. Each headline uses about 70 characters, which means that if I want ten headlines, I need to reserve 700 bytes (30%) of my available 2000 bytes of SRAM. That’s just to create the variables. Then my program had to concatenate the headlines into a long string of characters to be displayed by the marquee sign. That’s about ¾ of my available SRAM. I solved the problem by moving the individual headlines directly into EEPROM space at program startup, freeing-up 700 bytes.
  2. What actually drives the marquee is Gaurav Marek’s brilliant HT1632 library for Arduino. Along with this library comes a 5×4 font file. As you may have guessed from the name of the font file, each letter uses a rectangle of maximum 4 pixels across and 5 pixels down. However, the SURE 0832 display has a height of 8 pixels, so I redesigned the font for larger letters. The disadvantage to the new font file is size: my new font uses about 20% more space in SRAM than the original.

These SRAM space challenges were surmounted in time by moving the individual headlines into PROGMEM, and limiting the number of headlines displayed to seven.

However the SRAM requirements were not settled, because my plan was to attach an Ethernet Shield to the Arduino. The shield has its own library (conveniently included in the Arduino IDE), which requires more SRAM. But when I attached the shield, the unit failed to run. I tried reducing the headlines to one that simply read “help” but the marquee remained blank. There’s probably some interaction between the HT1632 library and the ethernet library, but I’m not competent or patient enough to try to resolve that issue.

I had another Ethernet shield, this one from Nuelectronics. This shield uses a different chip and has different libraries, and is altogether a more challenging device to integrate into an Arduino sketch. Although the shield does work with the marquee sketch, I was unable to adapt the library examples to my uses. That will have to wait for later.

SURE 0832 Display

The 0832 comes with ribbon cables and dip switches, prepared to be linked to three other modules. It’s a fairly simple matter to connect one module to the next and at the left end of the array, this is where you connect the Arduino. This is the pinout chart for my system, which uses Guarav Maurek’s HT1632 library. It permits easy individual pin assignments—a very useful utility, since Ethernet shields often use particular pins that can’t easily be changed. The pins on the SURE modules are labeled clearly on the back of each board.

Source Files

Click here for a ZIP archive of the Media Circus Arduino sketch and modified ‘font_5x4.h’ file for larger dot matrix type.

Update September 4, 2011

You can view more photos from this project at General Eccentric.

Update April 19, 2013

The General Eccentric Book and updated final code and drawings are available here.

Shy Dildo

A whimsical project called “Shy Dildo”: the object is a ‘personal massager’ that vibrates when left alone but stops when it is touched…

 

Of all the projects so far, the Shy Dildo was the simplest in concept—a vibrator that runs until it is touched—but the most difficult to actually design and build. I had actually assembled three completely different circuits, using four types of sensors.

They were, as I built them:

  1. Passive Infra-Red (PIR) sensor
  2. Infra-red LED emitter/receiver pair
  3. Ultrasonic Rangefinder
  4. Capacitive sensor

And once I had settled on capacitive sensing as the method for the project, several breadboarded versions were built. Even then, I had not covered all the technical issues, and without the generous advice of two engineers from Azoteq, the project would have been abandoned.

Passive Infrared (PIR) Design

The PIR is a motion detector that is used in security systems. It’s inexpensive, and can detect movement of warm body objects from several metres away. An Arduino controller handles the logic and drives the vibrator motor.But once I had breadboarded this, I realized that I didn’t want to detect motion, I needed to detect proximity (or contact).

Infra-red LED Emitter/receiver Pair

Drawings for IR Proximity Detectors

This method uses an infrared switch: this is a single component with four wires. Two wires drive an infrared LED and the other two wires are connected to an infrared detector (a reverse-biased IR LED). An Arduino controller handles the logic and drives the vibrator motor. This arrangement worked well, but it was too local: the vibrator is 15cm in length, but the infrared switch works only about 4cm around it, necessitating several IR detectors to be fitted along the length of the vibrator. I also wanted the sensors to be undetectable, so this method was rejected.

Ultrasonic Rangefinder

Ultrasonic Circuit

Ultrasonic rangefinders are common in robotic systems. They silently—at least for humans—repeatedly ‘ping’ into the air, using high frequency sound waves. A high-frequency microphone detects each ping and a micro-controller determines the distance from the target. The Arduino also drives the vibrator motor. This worked well, from about 20cm (far) to 2cm (close), but also suffered from the same drawbacks as the Infra-red LED switch.

Capacitive Sensor

I played with capacitive sensors years ago: Don Lancaster, in his classic “CMOS Cookbook”, discusses how the typically high-impedance inputs are so sensitive to changes in electromagnetic potential, that if you leave inputs hanging, they can pick up these changes and change digital states. The book contains several designs for touch and proximity sensors and switches. These methods are, however, less than dependable.

A design using the Azoteq IQS127D
A design using the Azoteq IQS127D

More “professional” approaches (does an art project that includes a dildo qualify?) to the capacitive sensing problem are available in the form of capacitive-sensing integrated circuits. Several are available: Futurlec offers the Quantum QT110, QT113 and QT118, but these have been unavailable for at least a year, presumably because Atmel has acquired Quantum, and Futurlec only sells Atmel microcontroller chips. Sparkfun sells one made by Analog Devices.

Sure Electronics, however, sells a set of five nifty IQS127D chips that are made by Azoteq, a South Africa-based company. The IQS127 chips from Sure Electronics are surface-mount, so Sure has helpfully included five SMD-to-.1 inch adapter boards. Because they are so small, surface mount devices require magnifying glasses, lots of light and a steady hand. Some people are intimidated by them but I enjoy the challenge. There are several good how-to videos on soldering surface mount chips.

The IQS127 is a magical chip [PDF]. It can be ‘tuned’ through software, but at its most basic, it has two inputs: pin one for proximity and pin 3 for touch sensing. Sure’s brief description of the chip:

IQS127D is a fully integrated capacitive sensor having dual outputs- Physical Contact (Touch) and Proximity output. It can operate with a minimum of 1 external component and project a touch pad through almost any dielectric. This device features an internal system regulator, ensuring class leading proximity sensitivity and stability. It is suitable for various dielectric overlays. In addition, a SOT23-6 converter board is provided for each chip so that you can break out the pins of the chip for better use in your projects.

95% of my experimentation on this chip was in its proximity sensing mode, but erratic behaviour forced me at the last minute (when I was testing the performance of my assembled and soldered final prototype board) to switch to touch sensing. More on that later.

The Vibrator

This is where I lucked out: I ordered an inexpensive vibrator at DealExtreme, in their “Naughty Products” section. I was looking for a simple gold or chrome coated vibrator… not an easy task on a site that has hundreds of “personal body massagers” of different designs, some true to life and others simply ridiculous, like the Santa Claus massager for $5.30 (free shipping!). However, I did find the needle in the haystack, and it arrived in working order. Not only that, but the chrome coating on the vibrator was conductive. Out of the hundreds of vibrators made in the electronics factories of Guangzhou, I found the one that conducts current! This meant that I could attach the sense wire to the outside of the vibrator and the entire surface could be used as a sensing plate.

Here’s a PDF of the Shy Dildo Electrical Connection Detail.

The Two Power Supply Problem

Since the IQS127D chip would handle the decision of when to turn on and off the vibrator motor, I was not required to include an Atmel microcontroller, which would simplify things somewhat. On the other hand, I had to deliver 1.5 volts to the motor and 5 volts to the IQS127D. The motor requires about 250 mA while running, and probably twice that to get from a full stop to full rotational speed. The IQS127D uses a few milliamperes, not enough to worry about.

Circuit idea using two LM317 adjustable regulators

My first design took a 12v DC input and routed it to two LM317 adjustable voltage regulators. One was configured to output 3v and the other to output 1.4v. The 3-volt supply powered the IQS127D and the 1.4-volt supply powered a transistor driving the motor. The transistor and the motor used reverse-biased diodes across them to eliminate inductive spikes that arise at motor startup. By the way, this web page is an excellent guide to the use of discrete transistors in common circuits. I (temporarily) abandoned the two regulator approach because the motor and the IQS127D seemed to interact in what seemed like a feedback loop that cycled every second or so.

Using a 7805 regulator and a 555 timer chip

My second design idea was a more elegant solution to the problem: the LM317 regulator cuts down voltage in a brute-force manner; the excess power is released as heat, requiring a heat sink if you are driving large loads. Instead, I would use a 555 timer chip to create a rudimentary switching power supply, making much more efficient use of the DC power available to me.

Using this circuit, a 555 timer chip was configured to output at 150 Hz with a 30% duty load sufficient to cause my multimeter voltage display to read 1.4 volts. This waveform would be fed into a NAND logic gate with the signal from the IQS127D, which would give me 1.4 volts when the IQS127D told me it needed it.

I sent a drawing to Azoteq for assistance…

Unfortunately, the feedback loop problems continued with this circuit. My engineering skills were inadequate to deal with the issues, so I sent a drawing of my circuit to Azoteq. The next day, I received a reply from Ross de Jager, which included an amended schematic. Ross noticed that

  1. there were no electromagnetic noise suppression capacitors fitted to the motor
  2. at the power supply, the capacitance at the voltage regulator entry point appears to be too small, which may cause a dip in the power supply voltage

I made the changes he suggested, but the performance was still not what I had hoped. I decided to abandon the 555 timer chip, go back to the two-regulator idea and try using a simple small relay to switch the motor on and off.

After about a month (during an unusually wet and dreary month of June here in Nova Scotia), I had another round of assistance from Ross at Azoteq. I was not unhappy with things at that point, because I’m not an engineer and I’m also more interested in getting a point across and amusing people.

In the video, the vibrator works until it is touched (actually actuator proximity is around 5mm from the surface of the device), but there are two aspects of its performance which troubled me:

  1. When getting close to the device, it cycled on and off. I wondered if this is to be expected? I also noticed that it seems to do this more under inductive load than under non-inductive load.
  2. Sometimes when the device was touched, it turned off, then turned back on almost immediately. Other times, it stayed off for ~20 seconds. I wondered if this was the expected behaviour?

Ross replied almost immediately:

An important point to remember here is, that if instability is present in the sense plate or environment, it will manifest here first when trying to detect proximity, as the IC is much more sensitive to current sample variations, especially if you have not programmed the IC to meet your application requirements. Floating metal could be a big problem and causes enough cyclic current sample variations to detect false proximity. In your case instability can be counteracted by either:

  1. Reducing proximity sensitivity threshold of the IC (Requires programming of the IC with the Azoteq CT200 configuration Tool)
  2. Ensuring that metal parts are gounded or used as a sense electrode, to prevent floating metal.
  3. Switch to the touch detection output of the IC (connect your motor activation line to PIN 1 of the IC, instead of PIN3)

From your viewpoint, I believe that you do not want to get into the programming details or configuration of the IC, so in your case I recommend that you opt for the third option, since in your application you want to detect a detect a stable touch, rather than proximity…

Ross helpfully followed up with a very helpful discussion on the concept of potentials and ground and pipe grounds and floating metal. I should reiterate that the IQS127D is not to blame here; I’m delighted with its performance. The difficulties that I encountered happened because I’m not an engineer. I’m just a ‘dopey artist’ (as I once heard my old teacher painter David Wright say). I took Ross’ advice about switching from proximity sensing to contact sensing. I made some final adjustments to the circuit, and it’s now finished:

Schematic for Shy Dildo v 2.3 [PDF] and source files.

Shy Dildo object
Shy Dildo object – Completed

Clock with Tics (using SURE 0832)

Clock with Tics using Sure Electronics 0832
Clock with Tics using Sure Electronics 0832

When I posted the original prototype of the Clock with Tics, Arduino Forum member mowcius commented that all the wiring and matrix driving could be greatly simplified with the LED matrices from Sure Electronics. While I was aware of the Nanjing-based company, I had not bought anything from them, nor had I seen them in the several electronics supermarkets that I had stumbled upon when I last visited the city.

Long story short: I bought a yellow LED 0832 module on ebay from Sure: they are remarkably cheap, about $9 each. Four of them can be strung together to make a respectable scrolling-message sign. Single units can be easily driven by an Arduino Duemilanove, but you can also buy a driver board that handles the higher current requirements if you need to string several together.

When I received it, I was busy with other matters and I put it aside. When I had a few hours here and there, I pulled it out and tried making the connection with an Arduino. I was not successful in getting past the self-test mode.

Last weekend, while waiting for replacement parts to arrive (also from Sure Electronics, by the way) for my ‘Shy Dildo’ project, I thought I’d attack the problem one last time. I had earlier unsuccessfully scoured the net for references to the 0832 module, but this time, I looked for “HT-1632”, which is the Holtek driver chip that’s used in the Sure module. Bingo!

I found several Arduino libraries that purport to work with HT1632 units. The first one that I successfully connected was from MakeHackVoid; it demonstrated the pin connections between the 0832 and the Arduino, and linked to libraries that enabled the 0832 to do the ‘crawling words’ scrolling thing. I spent most of the weekend playing with the code and re-working the somewhat erratic-looking font that came supplied with it. I could not, however, simply write a static string to the 0832.

Then I found Miles Burton’s library. This library has good documentation, and made it possible for me, a dopey artist, to figure out how to adapt the ‘Clock with Tics’ code from the presentation prototype to the Sure 0832 matrix. The process of getting to this point was complicated by several factors:

  1. A bad connection in a breadboard hookup wire
  2. Difficulties in sorting out the five different libraries that I had experimented with during the course of three days.
  3. A poor understanding (on my part) of the nature of chars and strings. I was unable to get my head around these concepts, and why the C language makes translation between chars and strings (and among other formats) so complicated. The Arduino String Library has limited documentation, and there doesn’t seem to be much in the way of helpful information elsewhere online. I don’t have any formal training in computer programming, and until Arduino I had avoided C.

The circuit for the new model should fit comfortably on one 6x9cm circuit board. I estimate that it is about 90% simpler to assemble. It has an added feature of a CDS (light cell) that allows the display to fade or brighten depending on the ambient light.

Clock with Tics for SURE Source Code (Github)

Clock with Tics for SURE Schematic (PDF)