Tag Archives: electronics

Building Radios

W1FB’s design for a VFO (Variable Frequency Oscillator): output on scope

I’ve not been posting consistently lately. The main reason is that I’ve been indulging my curiosity in radio technology. It started when I wanted to learn more about the wireless systems that I was building into my Arduino projects. The explorations and experimentation into radio have taken over, but I’ve not been able to answer in my own mind where this was taking me, until now.

So I’ve been building and playing with radio-frequency (RF) circuits, starting with oscillators, moving on to amplifiers and then simple radio receivers.

Some history might be helpful: A hundred years ago, when radio was new, experimenters built their own radio gear. The first radio transmitter was a device that made a spark, and a little later, sparks—which splashed energy promiscuously across a wide spectrum of frequencies—were replaced by narrow-frequency signals that could coexist with other signals with a radio that could select (or tune) into one signal and ignore the others. This signal is produced by an oscillator, which vibrates at a frequency of several million times a second.

Low power AM transmitter for test purposes

Wireless signals—whether they be wifi, Bluetooth, FM or your garage door opener—all use oscillators to carry information. So step one in anyone’s search for knowledge in this field is to build an oscillator.

Actually, there’s a step zero: in Canada, the electromagnetic spectrum is considered public property. You just can’t set up a transmitter and spew electric energy in all directions. You need to abide by a set of regulations set by Innovation, Science and Economic Development Canada, and above a certain power level for your transmitter, you may need to obtain a licence. In my case, I have a Basic with Honours amateur radio license VE1LEB, which allows me to experimentally transmit, using commercially-designed equipment, up to 250 watts in certain high-frequency bands. Unless I upgrade my licence to “Advanced”, I’m not allowed to employ a transmitter that I build myself — unless it’s a kit and/or I’m transmitting at a very low level.

Used as a buffer for AD9851 frequency generator

So when I build experimental oscillators, I’m only allowed to run them at very low power so that they can’t be heard more than a few metres from my house.

Here’s a practical example from last summer: I wanted to test the performance of a radio that receives signals in the AM broadcast band, between roughly 500-1600 MHz, but in Halifax, Nova Scotia, all of the AM broadcasters have vacated this band in favour of the FM band. So when you turn on an AM radio in Halifax (during the day, at least), you’ll get noise, hiss, static, but nothing intelligible to a human. So I had to build my own little radio station that would modulate an audio signal from a CD player with a carrier wave around 1000 KHz. Tune the radio to around 1000, and you should hear music (but only if the radio is sitting next to the modulator circuit).

Here’s another example from last Fall: this circuit is from a design by Doug DeMaw W1FB that combines an oscillator with an amplifier. It’s a VFO (variable frequency oscillator) with a buffer amplifier that can be used as a stage in either a transmitter or receiver. The circuit was built on a single-sided PC Board, with islands of copper cut out using a copper engraver’s burin—a tool acquired during my days as a Fine Art Major. The components are soldered onto the islands. The rest of the copper is known as a ‘groundplane’: reserved for connection to zero volts (ground).

Direct conversion receiver

After that, with an increase in confidence, I moved on to building simple radio receivers. The first one used an amplifier design from the book “Crystal Sets to Sideband” by Frank Harris K0IYE. It’s known as a direct conversion receiver, one that’s unusual from most radios we use today because it doesn’t make use of intermediate frequencies to step the signal down from it’s original frequency to audio frequency. The radio is composed of an oscillator an RF board and an AF amplifier.

Direct conversion receiver – close up

The radio signal is brought into the receiver via a coax cable gold connector at the top left. This signal is mixed with a sine wave signal at almost the same frequency as the one we want to tune to. By varying the frequency of the oscillator, we can tune into different frequencies, which will be displayed on the frequency generator unit. When these two signals are combined, the difference frequency is the audio from the radio station. This low-level audio is transferred to the lower board with a short coax cable to the audio amplifier, which drives small earbuds for listening. The battery pack at the top right delivers about 12 volts to the radio.

This report gets me caught up to late October 2016. My next post will introduce “regens“. I realize that I haven’t revealed where all this activity is taking me in my design research. It will come in later posts.

73!

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