Show Posts
Pages: 1 2 [3] 4 5 ... 248
31  Products / Arduino Due / Re: Why is Arduino Due cheaper than ArduinoMega2560? on: April 14, 2014, 09:05:34 pm
In single quantities, the ATmega2560 used in the Mega goes for over $18. The ATSAM3X8E in the Due is about $13.50.

The ARM chips seem to win hands-down as far as computing bang-for-the-buck but I don't know why. Maybe volume? The lower-end ARM chips are impressive as well. A 32-bit, 48MHz Cortex-M0+ with 128K flash and 16K SRAM is about the same price as an ATmega328P. The very smallest ARM chips are around a buck or so and that's still a 32-bit architecture operating at 30MHz.

Seems like the ARM licensing arrangement would tend to make prices higher, all other things being equal, but I'm not so sure.
32  Products / Arduino Due / Re: Anyone using CMSIS? How to get started? on: April 14, 2014, 08:52:55 pm
I've done quite a lot of programming on LPCs (great chips and environment BTW) ...

Thanks, I was wondering about that. I can see a consistent HAL for the ARM core (i.e. the CPU) but as you say, peripherals are different from every vendor so I was wondering how well that could work.

I poked around a bit on arm.com and found the CMSIS "specification" which I downloaded. It has "drivers" for things like Ethernet, I2C, SPI, USART, USB, external memory, etc. At this point I don't have a clue how to use them or whether they can be used. Looks like it's just .h files so just defining the interface. Probably each vendor would have to implement code to the specs. Throw things like switch matrices into the mix and I can see it getting crazy enough that I'd prefer just to program down the the bare metal, ha!
33  Using Arduino / General Electronics / Re: Help me improve my dire first attempt at soldering on: April 14, 2014, 06:08:25 pm
You don't say what went wrong exactly. What problems are you having?  350°C sounds about right.

I'm more familiar with the Weller equipment but the Hakko B-shape appears to be a conical tip, and the T18-B has a 0.5mm radius, so yes that's a bit large for surface mount or smaller through-hole work but typical of tips that come on irons from the factory. I prefer the screwdriver shape tips, the Hakko T18-D08 looks to be almost identical to the Weller tip I use the most. Tip size is a bit of a double-edged sword, smaller can be easier to work with, but the tiny area at the end will not get as hot or be able to transfer as much heat.

Without more information, I wouldn't blame all the problems on the tip. Be sure to keep the tip clean. I tin my tip very frequently by applying solder directly to it and wiping it in a brass-sponge type cleaner. The tip should be shiny and wet looking, even without a large amount of solder on it. This is the key to getting it to transfer heat. Don't leave the iron on for long periods if it's not being used as this just causes the tip to oxidize. I turn mine off or at least down even if I have to pause for a couple minutes.

Keep in mind that everything has to get hot enough to melt the solder, meaning the pad and the wire for through-hole components. Ideally, apply the iron to contact both pad and wire, give it a second to heat up, then apply solder to where the pad and wire meet. Sometimes it will be necessary to apply solder to where the iron meets the work. This is OK, but apply just a little at first, give it another second to heat up the wire and pad, then apply more solder to finish the joint. You'll know when things are hot enough because the solder will flow easily and fill the via.

34  Products / Arduino Due / Re: Anyone using CMSIS? How to get started? on: April 14, 2014, 10:09:40 am
Good info, keep it coming as you learn more. Every once in a while I pick up an ARM datasheet and think I need to learn more. Haven't found the time/motivation to get serious yet though smiley-confuse

My understanding is that CMSIS is a hardware abstraction layer for the Cortex-M series meant to provide a common interface to various vendor's chips. I'm not clear how successful it is, or to what extent various vendors comply with it.

I saw a question whether NXP had abandoned CMSIS, but they replied that their LPCOpen framework was CMSIS-compliant. With Atmel, I think that ASF comprises their effort for CMSIS compliance.

I've been looking a little at the Atmel SAM D series and also the NXP LPC800 series. NXP gets points for removing restrictions on the free version of their LPCXpresso IDE, namely C++ support is now included, and code size limitations eased or removed.

For me, one of the big selling points with Arduino is built-in or easily added common interfaces such as I2C, SPI, asynchronous serial, etc. I don't particularly care to reinvent those wheels for ARM but I'm hoping that CMSIS may be an answer.
35  Using Arduino / General Electronics / Re: somebody please explain this? sketch attached on: April 14, 2014, 07:59:26 am
hi guys i found this circuit diagram an how to control ac fan with arduino.

Can you give the link to where you found the circuit? Sounds like you got off on the wrong foot right from the start. Triac circuits aren't well suited to controlling AC induction motors, which is the type used on most of the fans around here anyway.
36  Using Arduino / General Electronics / Re: snubber circuit capacitor and resistor? on: April 14, 2014, 07:55:06 am
Seems like you're asking similar questions about the same circuit in multiple places.

Did you not read the guidelines about cross-posting?

When people ask very basic or naive questions about mains-powered circuits, that is usually an indication that they shouldn't be fooling with a dangerous situation that they don't well understand.
37  Using Arduino / General Electronics / Re: somebody please explain this? sketch attached on: April 14, 2014, 07:11:53 am
Thank you jack.  Btw what should be the power rating of the resistor and capacitor to be used?

I'd need to know the mains voltage.

BTW, what was the source of the schematic? It wasn't indicated there?
38  Using Arduino / General Electronics / Re: crystal or not? on: April 13, 2014, 06:41:29 pm
i have tried to search online for this item without any success.
can y'all tell me if this is indeed a crystal at 16.588 MHz?

Seems quite likely.

Quote
if so, being that the 328P can use 16 or 20 crystals, will this one work for stand alone chip with caps?

Difficult to say from a picture. A datasheet would be required. Different crystals have different resonant modes and other characteristics, the frequency is not the only (or even the most) critical item.

However, Arduino works best with clock speeds that are a power of two, i.e. 16, 8, 4, 2, 1MHz, etc. Speeds in between will cause millis(), micros() and delay() to be inaccurate. But, several people have made adaptations for 20MHz so I suppose anything is possible.

First thing would be to just try it.  No harm there, it'll either work or not. Of course, without a datasheet, it's impossible to say what the loading capacitor values should be.

The big question is why bother. Just get a proper 16MHz crystal. Five of 'em can be had for a buck here. Smaller package too smiley-grin
39  Community / Website and Forum / Dealing with spam on: April 13, 2014, 06:28:12 pm
I understood that recent changes and upgrades to the forum were partly to help with spam. Perhaps they have, but I also notice that spam continues to show up. I was using another forum the other day that has an interesting feature. A member's first N posts require moderator approval before they appear on the forum. Now I certainly don't want to add to our existing moderators' workload so it occurred to me that this task could be delegated to a cadre of assistant moderators. Spam posts are pretty obvious and N could be quite small, even just two or three. The assistants' only authority could be to approve or reject new members' initial posts. These posts would go into a queue where any of the assistants could review them. There are enough regulars on this forum, maintaining an ample team of assistant mods shouldn't be a problem.

There are one or two other details to work out, notably to define the process flow when an assistant rejects a post. I also have no idea what level of effort would be required to implement such changes, so maybe it's not even reasonable. But the moderation and delay inherent in the first few posts might serve as a powerful deterrent so I thought I'd float the idea.
40  Using Arduino / General Electronics / Re: somebody please explain this? sketch attached on: April 13, 2014, 04:48:37 pm
Only a fraction of a milliamp will flow C-D-E. The capacitive reactance of a 100nF capacitor at 60Hz is around 26K Ohms.
41  Using Arduino / Programming Questions / Re: How to return the class an object belongs to? on: April 12, 2014, 08:33:50 pm

Turned off via compiler option

Code:
sketch_apr12a.ino: In function 'void setup()':
sketch_apr12a:72: error: cannot use typeid with -fno-rtti
42  Using Arduino / Programming Questions / Re: Timer2 is slightly less accurate on: April 11, 2014, 07:18:47 pm
Assuming the aim is to output 500Hz from both timers, this should do the trick. I combined both into one sketch and also changed the output pins to PC1 and PC2:

Code:
#include <avr/io.h>
#include <avr/interrupt.h>

volatile int x = 0;

void timer1_init()
{
    TCCR1B = _BV(WGM12) | _BV(CS11) | _BV(CS10);    //prescaler = 64 and CTC mode
    TCNT1 = 0;                 //initialize counter
    OCR1A = 49;                //initialize compare value
    TIMSK1 = _BV(OCIE1A);      //enable compare interrupt
}

void timer2_init()
{
    TCCR2B = _BV(CS22) | _BV(CS20);    //prescaler = 128 and CTC mode
    TCCR2A = _BV(WGM21);
    TCNT2 = 0;                 //initialize counter
    OCR2A = 124;               //initialize compare value
    TIMSK2 = _BV(OCIE2A);      //enable compare interrupt
}

//Timer1 compare match
ISR (TIMER1_COMPA_vect)
{
    if (++x >= 5) {
        PINC |= _BV(PINC1);    //toggle output pin
        x = 0;
    }
}

//Timer2 compare match
ISR (TIMER2_COMPA_vect)
{
    PINC |= _BV(PINC2);        //toggle output pin
}

int main(void)
{
    DDRC = _BV(DDC2) | _BV(DDC1);    //timer1 ISR output on PC1, timer2 ISR output on PC2
    timer1_init();                   //initialize timers
    timer2_init();
    sei();                           //enable global interrupts

    while(1) {}                      //loop forever and do nothing here, the ISRs do all the work
    return 0;
}

If we're not real picky about which are the output pins, we can use the timers' output compare match facility to dispense with the interrupts (timer1 output on PB1, timer2 on PB3):

Code:
#include <avr/io.h>

void timer1_init()
{
    TCCR1B = _BV(WGM12) | _BV(CS11) | _BV(CS10);    //prescaler = 64 and CTC mode
    TCCR1A = _BV(COM1A0);                //toggle OC1A (PB1) on compare match
    OCR1A = 249;                         //initialize compare value
}

void timer2_init()
{
    TCCR2B = _BV(CS22) | _BV(CS20);      //prescaler = 128 and CTC mode,
    TCCR2A = _BV(COM2A0) | _BV(WGM21);   //toggle OC2A (PB3) on compare match
    OCR2A = 124;                         //initialize compare value
}

int main(void)
{
    DDRC = _BV(DDC2) | _BV(DDC1);    //timer1 ISR output on PB1, timer2 ISR output on PB3
    DDRB = _BV(DDB1) | _BV(DDB3);    //timer1 compare match output on PB1 (OC1A), timer2 on PB3 (OC2A)
    timer1_init();                   //initialize timers
    timer2_init();
    sei();                           //enable global interrupts

    while(1) {}                      //loop forever and do nothing here, the timers do all the work
    return 0;
}

43  Using Arduino / Programming Questions / Re: Timer2 is slighly less accurate on: April 11, 2014, 06:33:53 pm
Here is my code:
for Timer 2:
Code:
   // set up timer with prescaler = 128 and CTC mode
    TCCR2B |= (1 << WGM22)|(1 << CS22)|(1 << CS20);

That is not CTC mode, it's a "reserved" mode!

This would be CTC mode:
Code:
    TCCR2B |= (1 << CS22)|(1 << CS20);
    TCCR2A = (1 << WGM21);
44  Using Arduino / Programming Questions / Re: Timer2 is slighly less accurate on: April 11, 2014, 02:05:25 pm
It is! Just saw this recently in another thread.

If it isn't using the Arduino runtime then I don't see how you could consider it an Arduino sketch - it is just a bit of firmware running on the Arduino hardware.

Guess I'd have to look up the definition of an Arduino sketch. IMHO, if the Arduino IDE compiles it, and the Arduino hardware runs it, then I don't have any issue with calling it a sketch. Funny because I hate the word sketch anyways. Whatever. YMMV, a rose by any other name ... smiley-grin
45  Using Arduino / Programming Questions / Re: Timer2 is slighly less accurate on: April 11, 2014, 11:34:35 am
That isn't an Arduino sketch, is it?

It is! Just saw this recently in another thread.

Quote
You've provided your own main() and don't initialise or make any calls to the Arduino runtime.

Maybe that's the point smiley-wink
Pages: 1 2 [3] 4 5 ... 248