Show Posts
Pages: 1 ... 86 87 [88] 89 90 ... 114
1306  Using Arduino / Programming Questions / WinAVR, AVRStudio or AVR-GCC on: April 24, 2012, 06:32:46 am
   From this thread it looks as if AVRStudio is the current environment for ATMega development, is this correct or is there an alternative I should look at ?


Duane B
1307  General Category / General Discussion / Re: Breadboard Schematics on: April 24, 2012, 04:56:36 am
   You could just use different coloured single strand wire and a craft knife to build your bread board circuits neatly in the first place. It also makes it much easier if you want to transfer a design to permanently soldered strip board.

Take a picture of a neatly laid out bread board and everyone can see what you actually have wired rather than what you think you have wired.

Not the best example -

Its a lot neater than multi coloured flexible jumpers all over the place and if you stick with a convention like green for ground, red (yellow in my case) for power and white for signals its pretty readable. It takes seconds to measure off a piece of wire, cut it then roll it with the craft knife blade to strip it, it can be transferred straight to strip board for a permanent project or put back in your box for your next bit of bread boarding.

It is of course no substitute for schematics, but if you want help with something you have built, its the best/only way of communicating what you have built rather than what you think you have built.

Duane B.
1308  General Category / General Discussion / Re: Sinclair Spectrum 30 years old on: April 24, 2012, 04:41:51 am
   Games were a problem, but some of them were very good, especially the Konami catridges - Yei Ar Kung Fu, Road Fighter, Kings Valley etc. Getting all nostalgic now and going to have a reminisce on youtube.

Duane B
1309  General Category / General Discussion / Re: Sinclair Spectrum 30 years old on: April 24, 2012, 04:07:26 am
   I was one of about 6 people who bought an MSX. Mine was a Sanyo, but you could also get Sony, Mitsubishi, Yamaha, Toshiba etc if you preferred. From memory the Toshiba was the most popular and also had the worst looking keyboard of any computer ever - apart from the Spectrum :-)

Duane B
1310  Using Arduino / Project Guidance / Re: Making Small Lathe on: April 24, 2012, 04:03:00 am
   A lot of 'rock crawling' radio controlled models use what are called 'lathe motors' I assume these are motors that would have traditionally been used in hobby lathes. If you look around any RC Store focused on rock crawling, you will find lots of DC motors with detailed torque and rpm specs. They can also be powered through electronic speed controllers, you could get a motor and speed control for around 30 Usd. There are also 2 and three speed gear boxes designed to work with these, put that together with electronic speed control and you have a lot of flexibility to handle different materials.

Some well priced motors and specs here -

Just and idea,

Duane B
1311  Using Arduino / General Electronics / Re: op amp audio amplifier circuit help/suggestion on: April 24, 2012, 03:48:12 am
   For the VU Meter as above but in different words, you use a resistor ladder to set the trigger voltage for each LED, the LEDs are each connected to the output of one the op-amps, the signal is connected to the + input of all of the op-amps. Each op-amp then has a individual reference voltage above which it will turn on and light the connected LED, the reference voltage is determined by the resistor ladder which is simply a chain of resistors connected in series between the supply voltage and ground.

As your supply is probably much higher than you signal voltage, you use a single high value potentiometer as the first resistor in the chain, this is used to adjust the sensitivity of the rest of the resistor ladder by dropping more of less of the input voltage across the pot or the resistor ladder. After this first variable resistor, add fixed value resistors to set your trigger ratios (I had mine all equal using a 10K pot for sensitivity, then 680 Ohms for each of the reference voltage resistors, logarithmic might be better). The resistor ladder is giving us our reference voltages so we connect the -  input of each op-amp to a step in the ladder. As the input signal rises and falls so each opamp will continually be comparing it to its reference input, if it goes above the reference, the op-amp goes high and lights your LED.

Duane B
1312  Using Arduino / General Electronics / Re: 9v Battery - Arduino Uno R3 - PWR_SEL pins? Vin input - 5v output on: April 23, 2012, 10:55:08 pm
   The board is very flexible in how you power it. If you have a supply greater than 7.5 volts, you can feed it in via the power jack or the vin/gnd pins, the on board regulator will drop this down to the 5 volts needed by the chip. This regulated five volts is also available through the 5v pin. You do not need to add any jumpers, the five volts line is simply the output of the regulator attached to vin.

Its also very useful that you can still use a USB connection for programming and serial communication when the UNO is powered through the regulator.

Lastly, 9v batteries are not a very good power source if you plan on running any other devices connected to the Arduino - check the two links in my signature for details.

Duane B
1313  Using Arduino / Motors, Mechanics, and Power / Re: Using Servo library in a struct on: April 23, 2012, 08:57:40 am
No, but there is with the way you allocated them. When you call malloc you are simply asking for a memory space big enough to hold a servo object, this is not what is required, what you actually want to ask for is a 'new' servo object, this will create the space and call any constructor code required to initialise the space. Funnily enough, the command to do this is called 'new'.

If you know how many servos you need, just declare them the array way. You probably dont need the speed in your struct as you can use servo.readMicroseconds to get the current speed. Finally you can use C++ so you could use a class inplace of the struct, you could possibly just create a derived servo class which includes whatever it was that you wanted to store in your struct.

Duane B
1314  Using Arduino / General Electronics / Re: What chips to use????? on: April 23, 2012, 08:51:21 am
Its a fair comment from the OP though, until you know there are 'decade counters', 'quad op amps', 'darlington drivers', 'dual timers' etc etc etc it really is very hard to know whats out there or where to start.

I guess the best option is to start from the project you want to build and work back from there learning what you need on the way.

Duane B
1315  Using Arduino / Programming Questions / Re: Book on: April 23, 2012, 03:26:10 am
   I have just used the suggestions in this thread to look at the disassembled code for a sketch, its very interesting to see just how much goes on some functions, digitalRead is doing an awful lot to protect the user from themselves, I will be avoiding it in ISRs from now on.

I know this isn't news to many members, and a lot of the code is branching so only a fraction of it will be executed, but its still a bit of a wow for me to see just how much is going on in digital read -

int digitalRead(uint8_t pin)
uint8_t timer = digitalPinToTimer(pin);
    10f2: 68 2f        mov r22, r24
    10f4: 70 e0        ldi r23, 0x00 ; 0
    10f6: cb 01        movw r24, r22
    10f8: 82 55        subi r24, 0x52 ; 82
    10fa: 9f 4f        sbci r25, 0xFF ; 255
    10fc: fc 01        movw r30, r24
    10fe: 24 91        lpm r18, Z+
uint8_t bit = digitalPinToBitMask(pin);
    1100: cb 01        movw r24, r22
    1102: 86 56        subi r24, 0x66 ; 102
    1104: 9f 4f        sbci r25, 0xFF ; 255
    1106: fc 01        movw r30, r24
    1108: 44 91        lpm r20, Z+
uint8_t port = digitalPinToPort(pin);
    110a: 6a 57        subi r22, 0x7A ; 122
    110c: 7f 4f        sbci r23, 0xFF ; 255
    110e: fb 01        movw r30, r22
    1110: 94 91        lpm r25, Z+

if (port == NOT_A_PIN) return LOW;
    1112: 99 23        and r25, r25
    1114: 19 f4        brne .+6      ; 0x111c <digitalRead+0x2a>
    1116: 20 e0        ldi r18, 0x00 ; 0
    1118: 30 e0        ldi r19, 0x00 ; 0
    111a: 3c c0        rjmp .+120    ; 0x1194 <digitalRead+0xa2>

// If the pin that support PWM output, we need to turn it off
// before getting a digital reading.
if (timer != NOT_ON_TIMER) turnOffPWM(timer);
    111c: 22 23        and r18, r18
    111e: 51 f1        breq .+84      ; 0x1174 <digitalRead+0x82>
//static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline));
//static inline void turnOffPWM(uint8_t timer)
static void turnOffPWM(uint8_t timer)
switch (timer)
    1120: 23 30        cpi r18, 0x03 ; 3
    1122: 71 f0        breq .+28      ; 0x1140 <digitalRead+0x4e>
    1124: 24 30        cpi r18, 0x04 ; 4
    1126: 28 f4        brcc .+10      ; 0x1132 <digitalRead+0x40>
    1128: 21 30        cpi r18, 0x01 ; 1
    112a: a1 f0        breq .+40      ; 0x1154 <digitalRead+0x62>
    112c: 22 30        cpi r18, 0x02 ; 2
    112e: 11 f5        brne .+68      ; 0x1174 <digitalRead+0x82>
    1130: 14 c0        rjmp .+40      ; 0x115a <digitalRead+0x68>
    1132: 26 30        cpi r18, 0x06 ; 6
    1134: b1 f0        breq .+44      ; 0x1162 <digitalRead+0x70>
    1136: 27 30        cpi r18, 0x07 ; 7
    1138: c1 f0        breq .+48      ; 0x116a <digitalRead+0x78>
    113a: 24 30        cpi r18, 0x04 ; 4
    113c: d9 f4        brne .+54      ; 0x1174 <digitalRead+0x82>
    113e: 04 c0        rjmp .+8      ; 0x1148 <digitalRead+0x56>
#if defined(TCCR1A) && defined(COM1A1)
case TIMER1A:   cbi(TCCR1A, COM1A1);    break;
    1140: 80 91 80 00 lds r24, 0x0080
    1144: 8f 77        andi r24, 0x7F ; 127
    1146: 03 c0        rjmp .+6      ; 0x114e <digitalRead+0x5c>
#if defined(TCCR1A) && defined(COM1B1)
case TIMER1B:   cbi(TCCR1A, COM1B1);    break;
    1148: 80 91 80 00 lds r24, 0x0080
    114c: 8f 7d        andi r24, 0xDF ; 223
    114e: 80 93 80 00 sts 0x0080, r24
    1152: 10 c0        rjmp .+32      ; 0x1174 <digitalRead+0x82>
#if defined(TCCR2) && defined(COM21)
case  TIMER2:   cbi(TCCR2, COM21);      break;

#if defined(TCCR0A) && defined(COM0A1)
case  TIMER0A:  cbi(TCCR0A, COM0A1);    break;
    1154: 84 b5        in r24, 0x24 ; 36
    1156: 8f 77        andi r24, 0x7F ; 127
    1158: 02 c0        rjmp .+4      ; 0x115e <digitalRead+0x6c>

#if defined(TIMER0B) && defined(COM0B1)
case  TIMER0B:  cbi(TCCR0A, COM0B1);    break;
    115a: 84 b5        in r24, 0x24 ; 36
    115c: 8f 7d        andi r24, 0xDF ; 223
    115e: 84 bd        out 0x24, r24 ; 36
    1160: 09 c0        rjmp .+18      ; 0x1174 <digitalRead+0x82>
#if defined(TCCR2A) && defined(COM2A1)
case  TIMER2A:  cbi(TCCR2A, COM2A1);    break;
    1162: 80 91 b0 00 lds r24, 0x00B0
    1166: 8f 77        andi r24, 0x7F ; 127
    1168: 03 c0        rjmp .+6      ; 0x1170 <digitalRead+0x7e>
#if defined(TCCR2A) && defined(COM2B1)
case  TIMER2B:  cbi(TCCR2A, COM2B1);    break;
    116a: 80 91 b0 00 lds r24, 0x00B0
    116e: 8f 7d        andi r24, 0xDF ; 223
    1170: 80 93 b0 00 sts 0x00B0, r24

// If the pin that support PWM output, we need to turn it off
// before getting a digital reading.
if (timer != NOT_ON_TIMER) turnOffPWM(timer);

if (*portInputRegister(port) & bit) return HIGH;
    1174: 89 2f        mov r24, r25
    1176: 90 e0        ldi r25, 0x00 ; 0
    1178: 88 0f        add r24, r24
    117a: 99 1f        adc r25, r25
    117c: 84 58        subi r24, 0x84 ; 132
    117e: 9f 4f        sbci r25, 0xFF ; 255
    1180: fc 01        movw r30, r24
    1182: a5 91        lpm r26, Z+
    1184: b4 91        lpm r27, Z+
    1186: 8c 91        ld r24, X
    1188: 20 e0        ldi r18, 0x00 ; 0
    118a: 30 e0        ldi r19, 0x00 ; 0
    118c: 84 23        and r24, r20
    118e: 11 f0        breq .+4      ; 0x1194 <digitalRead+0xa2>
    1190: 21 e0        ldi r18, 0x01 ; 1
    1192: 30 e0        ldi r19, 0x00 ; 0
return LOW;
    1194: c9 01        movw r24, r18
    1196: 08 95        ret

Duane B
1316  Topics / Robotics / Re: Advice on: April 22, 2012, 10:47:34 pm
If you can solder, forget about shields and look up the L293E motor driver chip.

Duane B
1317  Using Arduino / Sensors / Re: LCD+LEDs+Sensor interface on: April 22, 2012, 10:43:29 pm

No idea what your issues are, but using 10 pins just to turn on/off LEDs seems like a waste of precious pins to me. Have a look at 'shift registers' for a way to drive more LEDs with less pins.

Duane B

1318  Using Arduino / Motors, Mechanics, and Power / Re: Issues with using ESCs and brushless motors on: April 22, 2012, 10:37:43 pm
  and you are using a separate power supply and the ground is connected to Arduino ?

Duane B
1319  Using Arduino / Programming Questions / Re: Book on: April 22, 2012, 02:39:47 pm
   It looks good, I have downloaded the PDF and will have plenty of time to read through it next week when I am stuck on a plane again.


Duane B
1320  Using Arduino / Sensors / Re: pulsein function on: April 22, 2012, 10:55:38 am
  If your trying to compile the three channel example, you will need to install the pcintchange library first. To keep things simple for now, try the example in the first link for now, that doesn't require any additional libraries.

Duane B
Pages: 1 ... 86 87 [88] 89 90 ... 114