Hi everyone! I'm A.K, nice to meet you all.
As you can see, I'm new to the forum (and also to Arduino) and I just had a quick question(s) to ask about the ATmega328 chip, but first, some backstory ...
I work on robot projects and I normally use processors from the Basic Atom Pro series from Basic Micro but they are pretty expensive and I wanted to expand my knowledge into different ICs and methods of programming, code, etc. so I decided to try out Arduino since it's incredibly popular.
So I'm looking around and I find some ATmega328's (which have the bootloader on them) so I order 2 of them, then I ordered some samples of the 'normal' versions from Atmel and from what I've read, the 'normal' ones need to have the bootloader burnt onto them so they can be used with the Arduino software ...
After some looking around, it seems that this can either be achieved using the programming cables or hooking up with an Arduino board you already own, correct?
Now I come onto my question - since I'll have the ATmega328 chip with the bootloader burnt on, would it be possible to somehow use that to burn the bootloader onto the normal one?
And just another quick question - I've also got one of these Bluetooth modules (Recommendations For You - DealeXtreme) and just to make sure I'm doing this right, I'd connect RX (on the IC) -TX (on the module) and visa versa?
Um ... that was pretty much all I wanted to ask (for the time being XD).
Thanks in advance!
AKdaBAOUS
P.S. If you'd like to check out the robot's I've made so far, here's a link to my site: http://kaizoku-robots.co.uk/Robots.html
The latest one which will be using the Arduino and bluetooth stuff will be a fox/wolf - not really too sure what to go with at the moment.
AKdaBAOUS:
since I'll have the ATmega328 chip with the bootloader burnt on, would it be possible to somehow use that to burn the bootloader onto the normal one?
Yes. You will need a USB to TTL Serial cable and some support hardware for both chips. The one to be used as an ISP device will need a 16 MHz crustal and load capacitors or a 16 MHz ceramic resonator. It will also be easier to use if you either add a reset button or implement the auto-reset feature. You will also need a 16 MHz crustal and load capacitors or a 16 MHz ceramic resonator connected to the chip being programed.
The USB-to-TTL-Serial (5V) will let you upload the ArduinoISP sketch to the chip that has the bootloader. The ArduinoISP sketch will let you burn a bootloader to the chip that doesn't yet have one.
Ok and just to confirm, is that 12 servos simultaneously or 12 servos overall?
Also, sorry about this but I've got another question - I'm going to be using a ceramic resonator (16MHz) so I'm assuming I won't be needing any external capacitors since they'll be internal? Also, the middle pin is the ground, correct?
Ok and just to confirm, is that 12 servos simultaneously or 12 servos overall?
You can control 12 pins. I suppose if you detach() one servo you could then control another on another pin but the one you detached will stop getting control pulses and may drift.
I'm going to be using a ceramic resonator (16MHz) so I'm assuming I won't be needing any
external capacitors since they'll be internal? Also, the middle pin is the ground, correct?
With the 328 chips, you cannot connect the Rx,Tx pins to both your BT module and the USB
port on the PC at the same time, as the signals will conflict.
You could also run optiloader on the AVR to be used as the bootloader burner.
That way you only have to deal with serial transmission once to get the optiloader
sketch in the AVR. Then the AVR will burn the bootloader in an other AVR every time
the AVR is reset.
For doing multiple bootloader burns, it will be much faster.
These show using an arduino board, but you can use it with your standalone
AVR setup once you get the optiboot sketch downloaded to the AVR.
With the 328 chips, you cannot connect the Rx,Tx pins to both your BT module and the USB
port on the PC at the same time, as the signals will conflict.
What if the bluetooth module was being used to allow communication with the board and my smartphone? I'm planning on writing an app to control the robot with.
@bperrybap: Thanks for the links - the multiple bootloader burns does sound like a very good idea!
Since the ATmega328 can only control 12 servos simultaneously, I found a Servo Controller Slave IC which can run 12 servos too and I was wondering if the following was possible:
The Servo Controller IC uses I2C to communicate so if I connect the SDA and SCL pins from the ATmega328 (pins 27 and 28 I think) to the corresponding SDA/SCL pins on the controller, I should be able to control 24 servos in total?
Servo 0; Servo 1; Servo 2; Servo 3; Servo 4; Servo 5; //Right Side Servos
Servo 6; Servo 7; Servo 8; Servo 9; Servo 10; Servo 11; //Left Side Servos
void setup()
{
//Assigning Right Side Servos to Pins
0.attach(0); 1.attach(1); 2.attach(2); 3.attach(3); 4.attach(4); 5.attach(5);
//Assigning Left Side Servos to Pins
6.attach(6); 7.attach(7); 8.attach(8); 9.attach(9); 10.attach(10); 11.attach(11);
}
void loop()
{
//Setting Leg Servos to '0'
0.write(0); 1.write(0); 2.write(0); 3.write(0); 4.write(0); 5.write(0);
6.write(0); 7.write(0); 8.write(0); 9.write(0); 10.write(0); 11.write(0);
delay(1000);
Servo::refresh(25);
}
Some comments on your code:
Variable names can't start with a digit so you can't have a Servo object named "0" or "1"... Try S0, S1, S2, etc, if you want short names.
You probably shouldn't use Pin 0 or Pin 1 unless you really have to. Those are the Serial I/O pins and if you use them for digital I/O you won't be able to use the Serial object for debug output. Debug output is particularly helpful for beginning programmers.