Show Posts
Pages: 1 ... 77 78 [79] 80 81 ... 248
1171  Using Arduino / Microcontrollers / Re: Programming ATTiny24 (and 44/84 of course) on: May 15, 2013, 04:47:59 pm
If you're not already aware, y'all should check out:

There are several others but those are the two I've tried.
1172  Community / Website and Forum / Re: The Forum is Buggy on: May 15, 2013, 04:41:49 pm
There was a post or two on Twitter, so props for that.
1173  Using Arduino / Project Guidance / Re: Methods of using buttons and reliability on: May 14, 2013, 10:00:46 pm
In addition to their ADC function, analog pins also function identically to digital pins, so they'd work perfectly fine.
1174  Using Arduino / Project Guidance / Re: Methods of using buttons and reliability on: May 14, 2013, 09:38:11 pm
As long as pins are available, one button per pin is the simplest and most reliable approach. If a very large number of buttons is needed, then multiplexing or an I/O expander are options.
1175  Using Arduino / Programming Questions / Re: Can the DS3231 RTC calculate the Day of Week based on the Date set? on: May 14, 2013, 12:00:59 pm
Just to expand a bit on what Riva said, the DS3231 has a register (0x03) that tracks DoW as a number between 1 and 7. It increments at midnight and rolls back to 1 after 7. It's up to the user to decide which day corresponds to which value and set it correctly.

Personally, I usually use the Time library which does the calculation. Set the time and date, and it calculates the correct DoW. When using the Time library with an RTC, the RTC's DoW register is irrelevant (but not, of course, the date and time registers).
1176  Using Arduino / Project Guidance / Re: AC Dimmer with PR36MF2xNSZ on: May 11, 2013, 08:55:12 pm
Ok, found PR36MF12NSZF. Will I need more parts to do 220VAC dimmer?

Yes. See the sample circuit in the datasheet for starters. Also, the Arduino will need a way to detect zero crossing, then delay turning on the SSR until some later point in time to control brightness.

Good luck. GIYF. Keep one hand in a pocket so you don't electrocute yourself.
1177  Using Arduino / Project Guidance / Re: AC Dimmer with PR36MF2xNSZ on: May 11, 2013, 08:16:57 pm
Sorry. So any other SSD relay I can do this job with?

Yes, a random-phase, i.e., non-zero crossing type. At the top of the datasheet it lists some possibilities:

∗Non-zero cross type is also available. (PR26MF1xNSZ Series/PR36MF1xNSZ Series)
1178  Using Arduino / Project Guidance / Re: AC Dimmer with PR36MF2xNSZ on: May 11, 2013, 07:41:26 pm
So is there a way I can make an AC Dimmer with PR36MF2xNSZ and arduino? What parts should I use?

Umm. See Reply #1.
1179  Using Arduino / Project Guidance / Re: AC Dimmer with PR36MF2xNSZ on: May 11, 2013, 07:33:48 pm
A triac, which switches the load, has the characteristic that once it is triggered into conduction, it continues to conduct until the load current falls to some near-zero value.

The way a triac is used in a dimmer is to switch it on at some variable point on the sine wave. When the current drops to zero (when the sine crosses zero), the triac turns off, then the triggering circuit repeats the same thing on each half-cycle. Where on the sine wave the triac is turned on determines the amount of power delivered to the load and hence the brightness of the lamp.

This process generates a lot of EMI due to the sharp step in current when the triac begins conduction. Usually lamp dimmers have filter circuitry to reduce the EMI generated.

Another way to reduce EMI is to turn the triac on immediately after the zero-crossing point on the sine wave. However, this means that the triac will conduct for the entire half-cycle. It also means that this type of circuit can only be used for on/off control.
1180  Using Arduino / Project Guidance / Re: AC Dimmer with PR36MF2xNSZ on: May 11, 2013, 07:19:35 pm
Not possible. A random-phase unit is required, i.e. without the zero-crossing detector.

Have you worked with 220VAC before, familiar with appropriate safety measures, etc.?
1181  Using Arduino / Programming Questions / Re: [help,urgently] arduio programing problem on: May 10, 2013, 10:15:12 pm
For anything being assigned to a pin, it should be a byte, it saves memory even if it is just one byte less. For anything that actually requires more memory usage like an int or long, signed or unsigned, fine, but a regular pin should be a byte.

I'm curious as to what the compiler makes a #define variable.

Short answer: None of the above.

Long answer: #define is a preprocessor directive, the compiler never sees it. #define does not define a variable. Given

#define identifier replacement

the preprocessor literally replaces each occurrence of identifier in the source code with replacement. Think of it as a text-based replacement like might be done with a word processor, e.g. replace every occurrence of foo with bar. The compiler gets the source code after the replacements occur.

Even longer answer:
1182  Using Arduino / Microcontrollers / Re: UNO & ATMega328 with internal clock on: May 08, 2013, 06:39:15 am
Not having a pullup on the reset pin is just plain wrong.

They're a very bad idea if you're worried about power consumption.

I made a device the other day which consumed an average of 3 microamps. If I added a 10k pullup on the reset pin it would consume 0.3 milliamps - 100 times more than the device just for the pullup!

Something else must be going on. I always have a 10K pullup on the reset pin and have no trouble achieving 0.1µA in power-down mode as per the datasheet. In fact, my SOP is to make all unused pins inputs with pullups. CMOS circuitry has exceedingly high input impedances, a pullup on an input pin will draw effectively no current. I was just taking some measurements yesterday:,164146.msg1232507.html#msg1232507
1183  Community / Website and Forum / Re: can we force new posters to read forum stickies? on: May 07, 2013, 06:24:35 pm
It could work the same way that software companies make people read the license agreements smiley-wink
1184  Using Arduino / Microcontrollers / Re: When sleeping helps on: May 07, 2013, 02:14:33 pm
Do we have data on how much power is consumed by an actual Arduino board in Sleep vs running, for various power sources?
I think I've dismissed this as "it doesn't get low enough for long-lived battery operation", but it occurs to me that that is not at all the same as "not significantly lower."

Here is some data from various Arduino I had kicking around. 5V power supply in all cases, fed to the 5V pin. While I would have to call a 25% to 30% reduction "significantly lower", I'm still in the "it doesn't get low enough for long-lived battery operation" camp where actual Arduino boards are concerned.

Uno R1
38mA running, 26mA with MCU in power-down mode.

Uno SMD edition
42mA running, 31mA power-down.

Adafruit Boarduino
Power select jumper set to "USB", USB (FTDI) not connected.
15mA running, 3mA power-down.

Adafruit Boarduino sans power LED
12mA running, 0.1µA power-down.

ATmega328P-PU on a breadboard
12mA running, 0.1µA power-down.

//Sketch to measure current while sleeping.
//Wire a button from pin D2 (INT0) to ground.
//Pushing the button wakes the MCU.
//Once awake, the MCU flashes the pin 13 LED, then
//waits 10 seconds before going back to sleep.
//Jack Christensen 07May2013

#include <avr/sleep.h>

#define LED LED_BUILTIN            //LED on pin 13

byte intCounter;                   //interrupt counter

void setup(void)
    EICRA = 0x00;                  //configure INT0 to trigger on low level

void loop(void)
    for (byte i=0; i<5; i++) {
        digitalWrite(LED, HIGH);
        digitalWrite(LED, LOW);

void goToSleep()
    byte intCounter, adcsra, mcucr1, mcucr2;

    EIMSK = _BV(INT0);             //enable INT0
    adcsra = ADCSRA;               //save the ADC Control and Status Register A
    ADCSRA = 0;                    //disable ADC
    mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);  //turn off the brown-out detector
    mcucr2 = mcucr1 & ~_BV(BODSE);
    MCUCR = mcucr1;                //timed sequence
    MCUCR = mcucr2;                //BODS stays active for 3 cycles, sleep instruction must be executed while it's active
    sei();                         //ensure interrupts enabled so we can wake up again
    sleep_cpu();                   //go to sleep
    sleep_disable();               //wake up here
    ADCSRA = adcsra;               //restore ADCSRA

    EIMSK = 0;                     //disable interrupts (only need one to wake up)

//make all pins input pins with pullup resistors to minimize power consumption
void makePinsInput(void)
    for (byte i=0; i<20; i++) {
        pinMode(i, INPUT_PULLUP);  
    pinMode(LED, OUTPUT);          //except the LED pin
    digitalWrite(LED, LOW);
1185  Using Arduino / Programming Questions / Re: What does "dht DHT;" mean on: May 07, 2013, 06:14:49 am
It is just like writing something like

int foo;
Pages: 1 ... 77 78 [79] 80 81 ... 248