-1
\$\begingroup\$

I'm a student and having a project that using an ATmega8-16PU to control simple alarm (just LED and Buzzer) with SMS (using a Sony Ericsson K508i as a GSM module). Refer to this link

I have questions :

  1. Should i use internal 8Mhz or an extra external 8Mhz crystal for 9600 Baud Rate ? I had read before that better not to use internal clock.
  2. It says to use a phone-RS232 cable (cut off the plug and connect the wires), but can i just directly connect the phone Tx Rx pins to ATmega8 Rx Tx pins ?

Please Help, I'm a software engineering student and have minimal hardware knowledge. This is my first time working with microcontroller.

\$\endgroup\$
  • \$\begingroup\$ I've never had a problem with internal oscillator for serial comms, but some people have. It appears that connecting directly is save: both types of signal are 5V: using the cable might be physically easier. \$\endgroup\$ – angelatlarge Apr 4 '13 at 3:40
  • \$\begingroup\$ Thank you @angelatlarge for the comment. I'm ready to setting my ATmega8 to using internal oscillator at 8Mhz. But as i know so far, you can only setting it just one time, right ? or if using internal is not working for the serial comms, can i set it again using an external one ? --- Yes, some said it save to working at 5V, but the phone working at 3V, i just confused with others that use max232. \$\endgroup\$ – DexDarrel Apr 4 '13 at 4:14
  • \$\begingroup\$ Your second link said 5v, so if that's right you are OK. If it is 3V you will need serial level shifter. Yes, try internal first, then change to exteral: you tell the ATmega which one to use by setting fuse values \$\endgroup\$ – angelatlarge Apr 4 '13 at 4:17
  • \$\begingroup\$ @angelatlarge Thanks for your time. I don't know anything about serial level shifter, do you have any link that explain it simply ? or how to build one ? or maybe i can just use [2k Ohm resistor] (arduino.cc/forum/index.php/topic,52794.0.html) ? \$\endgroup\$ – DexDarrel Apr 4 '13 at 4:55
  • \$\begingroup\$ See here. Or just buy (or get samples of) the MAX3223 \$\endgroup\$ – angelatlarge Apr 4 '13 at 4:55
0
\$\begingroup\$

Some answers collected from the comments above:

  • On the internal vs. external oscillator: YMMV. I've never had problems with the internal oscillator, but some people have had issues with it. You switch the setting for using internal oscillator versus external crystal resonator by programming the chip's fuses
  • Whether you can connect the phone directly to your ATmega 8 depends on whether both are running on the same Vcc. ATmega8L can run on as little as 2.7V, whereas ATmega8 (no L) needs at least 4.5V. I don't know what the phone runs at, your second link seems to suggest 5V.
  • If the voltage is not the same you will need to shift at least the phone's RX/ATmegas TX line down to the level that will not blow the phone. See this post for some strategies. The phone's TX/ATmega's RX line should be fine: the phone's 3V high should register correctly as high on the ATmega. I have usually used the diode+resistor strategy for shifting a single line to 3V3 on two-wire interfaces. But if you want a chip for this you can use the MAX3223.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.