Posts with «ac» label

Arduino Replaces Bad AC Thermostat, Hacker Stays Cool

Most of North America has been locked in a record-setting heat wave for the last two weeks, and cheap window AC units are flying out of the local big-box stores. Not all of these discount units undergo rigorous QC before sailing across the Pacific, though, and a few wonky thermostats are sure to get through. But with a little sweat-equity you can fix it with this Arduino thermostat and temperature display.

We’ll stipulate that an Arduino may be overkill for this application and that microcontrollers don’t belong in every project. But if it’s what you’ve got on hand, and you’re sick of waking up in a pool of sweat, then it’s a perfectly acceptable solution. It looks like [Engineering Nonsense] got lucky and had a unit with a low-current power switch, allowing him to use a small relay to control the AC. The control algorithm is simple enough – accept a setpoint from an encoder, read the temperature sensor, and turn the AC on or off accordingly. Setpoint and current temperature are displayed on an OLED screen. One improvement we’d suggest is adding a three-minute delay between power cycles like the faceplate of the AC states.

This project bears some resemblance to this Arduino-controlled AC, but it seems more hackish to us. And that’s a good thing – hackers have to keep cool somehow.

Filed under: Arduino Hacks, home hacks

use mains AC as a switch for arduino?

hey gang, does anyone know if it's possible to use mains AC as a switch for the 'duino?

A little background:

Calculon is working on a project that he hopes will take advantage of his doorbell's AC power. He wants the old-school analog doorbell switch to activate a function on his arduino instead of firing off a solenoid in the door chime. Is this possible with some sort of voltage divider? He doesn't need to measure the current, voltage, phase, or anything liek that, he just needs to sense on/off like a pushbutton. He assumes the initial doorbell voltage will be 120V.

read more

Let's Make Robots 14 Feb 03:40
ac  arduino  doorbell  electronics  mains  

Audio Input to Arduino

The easiest way to connect audio signal to your arduino, is build a simple 3 components (2 resistors plus cap) circuitry shown on the first drawings on right side. Disadvantage: as there is no amplifier, sensitivity would be low, hardly enough to work with headphones jack output.  For low level signals, like electret microphone, amplifier is necessary. Here is the kit, which included board, electronic components and NE5532 Operational Amplifier IC:

  Super Ear Amplifier Kit

Other option, from SparkFun Electronics:

  Breakout Board for Electret Microphone

Note: I don’t recommend to replace NE5532 OPA with popular  LM358 or LM324 due their pure frequency response above > 10 kHz.

Configuring AtMega328 ADC to take input samples faster:

void setup() {

   ADCSRA = 0×87; // freq = 1/128, 125 kHz. 13 cycles x 8     usec =  104 usec.
// ADCSRA = 0×86; // freq = 1/64,   250 kHz. 13 cycles x 4     usec =   52 usec.
// ADCSRA = 0×85; // freq = 1/32,   500 kHz. 13 cycles x 2     usec =   26 usec.
// ADCSRA = 0×84; // freq = 1/16 ,    1 MHz. 13 cycles x 1      usec =   13 usec.
// ADCSRA = 0×83; // freq = 1/8,       2 MHz. 13 cycles x 0.5   usec =  6.5 usec.
// ADCSRA = 0×82; // freq = 1/4,       4 MHz. 13 cycles x 0.25 usec = 3.25 usec.

ADMUX    = 0×40;                          // Select  Analog Input 0

ADCSRA |= (1<<ADSC);                 // Start Conversion

Timer1.initialize(T_PERIOD);           // Sampling with TimerOne library


Reading and storing samples to array via ISR ( Timer Interrupt Subroutine ), Timer1 in this example:

void iProcess()
static uint8_t n_sampl;
if (ADCSRA & 0×10)
int16_t temp = ADCL;
         temp += (ADCH << 8);
          temp -= sdvigDC;    
    ADCSRA |= (1<<ADSC);
xin[n_sampl] = temp;

if (++n_sampl >= FFT_SIZE )
n_sampl = 0;
process = 1;


Don’t like to solder all this components from the drawings above? Here is easy way around, if you, by chance, have a spare USB speakers around. Something like this:

Note: Speakers should use USB port as a power source, not AC power outlet!

1.  Open box up, and look  what kind of chip (IC) Power Amplifier inside, on the PCB board:

2.  TEA2025 in this example, but could be different in yours. Not big deal, just write down the name, than go on-line and try to find a data sheet for your particular chip. My favorite links:  1   and   2.  From the data sheet you will find pin numbers of two outputs, for left and right channels. Just solder couple of wires to ground and to one of the output and that’s it!

3. If printing on the IC body is unreadable, or couldn’t find a data sheet, it is possible to trace two wires from the speaker to IC. Most likely, there would be an electrolytic cap installed in series, between chip output and speaker. Solder a signal wire on the chip’s side of the cap, or near IC. There is a slim chance, of course, that IC configured in bridge configuration, and wouldn’t be any caps. It’s even better, just use ether of two speaker’s wires as a signal line, and ground as ??? a ground.

Be careful, use different color of wires for ground line and signal line. There would be no protection, and wrong polarity could damage an analog input of the arduino board, and in some occasions Power Amplifier IC. To prevent this, I’d strongly advise to install 10 kOHm resistor in series with signal wire.