Vol. 16: Hacking the Glade Wisp
Make your own scent output peripheral from a piezo air freshener.
By Wayne Holder
Photos by Wayne Holder
Digital Edition
SUBSCRIBERS:Read this article now in your digital edition!
Get Make:
Subscribe to MAKE and get the best rate!
+ Downloads & Extras:
Single Wisp Control Code
void setup () {
DDRD = 0xFF;
}
void atomize (char pins) {
unsigned int ii;
char kk;
while (digitalRead(8) == HIGH)
;
for (ii = 0; ii < 2000; ii++) {
PORTD |= pins;
for (kk = 0; kk < 12; kk++)
;
PORTD &= !pins;
for (kk = 0; kk < 12; kk++)
;
}
}
void loop() {
atomize(0x04);
delay(2000);
}
In the code, the DDRD and PORTD keywords configure the Arduino's D0-D7 pins as outputs to be controlled directly, by using the Arduino's port manipulation commands. The nested loops in the atomize() function toggle the D2 pin (specified by passing in the value 0x04) on and off a total of 2,000 times, with a very short pause after each change. The values I chose for the delay loops make the Arduino's output roughly match the Wisp controller's, but with a shorter, 2-second delay between puffs. You may have seen other code that controls the Arduino's digital outputs by calling digitalWrite(), but this would be too slow to generate a 150MHz signal.
You can experiment with setting the loops to count up to values other than 2,000 and 12 to see how this changes the atomization process, but note that shorter delay times may not give the circuit's 3,300µF capacitor enough time to fully recharge between puffs, which will result in significantly decreased vapor output.
"Orchestra of Fragrance" Keyboard-Controlled Wisp Array Code
Because the Arduino's PORTD value lets you write to all of its digital outputs at the same time, 1 Arduino can control up to 6 Wisps simultaneously. You simply connect each Wisp to a different output pin and pass different values into the atomize() function.
Using the Arduino programming environment's Serial Monitor feature, you can send keyboard characters to the Arduino, which lets you create an instrument that plays fragrances, live. Just make sure to avoid using pins D0 and D1, which share their function with the serial port.
For example, the following code reads an input character and uses it to select which of 4 different Wisps to puff. Typing the 2 key commands the Wisp that's connected to pin D2, typing 3 commands pin D3, and so on.
void setup () {
DDRD = 0xFF;
Serial.begin(9600);
}
void atomize (char pins) {
unsigned int ii;
char kk;
for (ii = 0; ii < 2000; ii++) {
PORTD |= pins;
for (kk = 0; kk < 12; kk++)
;
PORTD &= !pins;
for (kk = 0; kk < 12; kk++)
;
}
}
void loop() {
char cc = Serial.read();
switch (cc) {
case '2':
atomize(0x04);
break;
case '3':
atomize(0x08);
break;
case '4':
atomize(0x10);
break;
case '5':
atomize(0x20);
break;
}
}
To set this up, load the code to the Arduino board, then click the Serial Monitor button, which is the rightmost button at the top of the Arduino's development environment. This will display a set of controls near the bottom of the window. Select 9,600 baud, then type a number (2-5) into the text box and press Send. This should trigger the corresponding pin, and the Wisp its connected to.
» MAKE: AMENDS Errata for This Article
Correction for page 163
In Steps 2 and 3, references to a 150MHz signal should have been to a 150KHz signal.
» MAKE: NOISE — Discuss this article
You must be logged in to post a talkback.[ Display main threads only] [ Oldest First]
Showing messages 1 through 11 of 11.
- Piezo atomizer
You must be logged in to reply.
Hi,
I would like to make a piezo atomizer, but without buying a Glade Wisp.
I have been using an Arduino Duemilanove to drive a piezo buzzer from an alarm. If I immersed the piezo in essential oil, would I get oil mist?
Thanks,
FIXITPosted by THE G33K on October 05, 2009 at 13:25:06 Pacific Time
- having a hard time getting this working...
You must be logged in to reply.
I'm pretty good with the Arduino (I teach it) and with electronics, but I can't seem to get the wisp to puff. If I listen carefully, I can here a faint click every two seconds, but it does not seem to be vibrating the piezo strongly enough to puff as it does when not hacked. Any suggestions would be greatly appreciated (I'm hoping to use this for an art piece).Posted by johnslep on June 08, 2009 at 16:37:46 Pacific Time
- having a hard time getting this working...
You must be logged in to reply.
Can you tell me what version of the Wisp you used. Is it the same model mentioned in my article?Posted by wholder2 on June 08, 2009 at 22:33:05 Pacific Time
- having a hard time getting this working...
You must be logged in to reply.
Sadly, now sort of worse, even with Arduino Mini. Started and stopped it a few times, and now all I get is the faint click for three or four times. Tried with two different Wisps that I have wired up. Maybe it's mechanical? Thanks much.Posted by johnslep on June 09, 2009 at 11:25:53 Pacific Time
- having a hard time getting this working...
You must be logged in to reply.
Hi,
Thanks for responding. Yeah, it's the exact same one (I was careful about that, and actually bought three to work on). I finally got it working, sort of. Now it's doing a weird thing where it puffs the first three times or so and then stops. I'm using an arduino mini (the only Atmega168 board I have). I tried a Atmega328 based board (which is also 16MHZ) but got the results I first mentioned. Wondering if it's a weird voltage issue. Any thoughts would be great. It's an awesome hack.Posted by johnslep on June 09, 2009 at 11:01:47 Pacific Time
- wisp with LED not working
You must be logged in to reply.
Hi, I can't get the wisp with the LED to work with the arduino board. I don't have an oscilloscope and wondered if anyone knows the frequency for this wisp model?Posted by mikel203 on April 03, 2009 at 23:01:05 Pacific Time
- Basic Stamp doesn't drive the piezo
You must be logged in to reply.
I can't find a Wisp without the LED, but other than that, I don't think the circuit is much different. Did you have to link the power supplies to provide charging for the 3300uF cap? I don't seem to get much boost with just driving the gate, it certainly doesn't make the piezo mist. I'm also using a basic stamp, instead of an arduino but I am thinking I supply enough current to drive the FET. Any ideas? Do you think it's better to just desolder the two inductors, cap and FET and make a little breadboard and not even use the Wisp board?Posted by Dave Ghilarducci on February 03, 2009 at 20:28:53 Pacific Time
- Basic Stamp doesn't drive the piezo
You must be logged in to reply.
I used the battery to power the glade and used the Arduino only to supply the drive signal. The piezo disk is part of a resonant circuit, so I believe the drive frequency is critical. I spent most of my time measuring the frequency the built-in drive circuit sent to the MOSFET and then adjusting the Arduino timing loop to try and match this as closely as possible. I can't tell you how to make it work with the Basic Stamp but, as long as it can produce a comparable 150 Hz signal, it should work.Posted by wholder2 on February 03, 2009 at 20:49:12 Pacific Time
- Basic Stamp doesn't drive the piezo
You must be logged in to reply.
I hadn't looked at it as a resonant circuit, I thought of the piezo as a speaker vibrating from the input and oscillating the liquid into a mist. I just figured the toroid ( L2 on my board) was working with the 3300 uF cap and L3 to make a boost circuit with pretty high voltage, but almost no current to the piezo. With that theory, something's not working, but if it is a tuned circuit, then I definitely was missing something. Thanks, I'll keep you posted on what I find.Posted by Dave Ghilarducci on February 05, 2009 at 11:11:10 Pacific Time
- Re: 150 MHz
You must be logged in to reply.
Yes. The text should have read "150 KHz". Somehow this was changed during typesetting and I missed it when proofreading. Sorry for the confusion.
WaynePosted by wholder2 on December 02, 2008 at 12:12:01 Pacific Time
- 150MHz?
You must be logged in to reply.
Are you sure that 150MHz is correct? Only, the Arduino's CPU clock frequency is only 16MHz, so that's nearly ten times faster. Doesn't quite make sense -- should it be 150kHz?
John Honniball.Posted by c0redump on December 02, 2008 at 09:08:54 Pacific Time
|
Showing messages 1 through 11 of 11. |
Join the conversation -- every MAKE article has an online page that includes a place for discussion. We've made these RSS and Atom feeds to help you watch the discussions: subscribe.










