I've been off and on with electronics for a couple months now. Well, I am back into the swing of things and I have a renewed interest in Arduino. I was looking at the Arduino Standalone Page (http://www.arduino.cc/en/Main/StandaloneAssembly) and the interface/communication chip that they use is the 7404. Now, I am just curious as to why they decided to use a 7404 when MAX232 is much more capable and creates true RS-232.
I am going to be experimenting with my own single sided Arduino and I was pretty confident on using MAX232. Is there any other DIP chips that are suited for conversion to RS-232 or USB? Anything faster than a MAX232?
Mostly curious but also trying to develop a good board at the same time.
Well, they do say they are using it to replace the transistorized version (which I imagine is real similar to the transistorized interface you see on certain Basic Stamp 2 implementations); maybe the 7404 is easier to obtain than the MAX232 in some areas (or maybe it was this way at one time)?
I say if you're going to use the MAX232 or something else, go for it; ultimately it doesn't matter. What you might do, though, is skip an interface entirely, and just bring the pins out to a header, and plug in with an FTDI cable or breakout (or similar device).
Or, bring out the ICSP pins to a header, and just use an AVR programmer, and drop the bootloader (while gaining back 512 bytes - 2K, depending on the vintage of your bootloader)...
I was just wondering if there was any particular reason for using the 7404. Maybe like a compatibility thing?
I would say likely it is because its a fairly common TTL IC, it handles the inversion without needing extra components, easily socketed (if needed), plays well on a breadboard (breadboarding a transistorized RS232 level convertor is possible, but the layout can be a pain), and is probably pretty tolerant to a certain level of "abuse"...
Also (though I haven't priced it), maybe the DIP 7404 is cheaper than a MAX232 DIP part...?
Good point. I was just wondering if there was any particular reason for using the 7404. Maybe like a compatibility thing? But there's not much to be incompatible with such basic stuff.
When one needs to convert serial communications to and from RS232 voltages to serial TTL voltages there are two functions that have to be performed:
Voltage translation, i.e. +/- 12 volt signals to TTL 0/+5vdc levels.
There needs to be a logic inversion such that the RS232 'mark' level (-12v) translates to +5vdc, and the +12v 'space' level translates to 0 volts.
I haven't looked at the circuit you mentioned but I bet the 7404 is performing the logic inversion function while other external components are dealing with the voltage translations. As already stated, this requirement can be met in several ways, discrete components, older ICs or newer purpose chips like the max232 type chips. I think there must be a zillion circuits out there on the web that can be made to work. I've used the max232 chip and it is pretty simple and works well.
Maybe I phrased everything wrong. Can the 7404 be used to take the I/O of the ATMega and convert it to the appropriate voltages for communication with a computer? That is, not having to use a cable that has a TTL converter or whatever embedded.
And you said no other external components? (As in capacitors?) A MAX232 circuit needs 5 small capacitors for proper function.
7404 is a simple TTL hex inverter; rather robust, cheap, and easy to find. While rs232 is supposed to have "1" less than -3V and "0" > +3V, the 0/5V produced by a TTL inverter "usually" works. It's pretty much the LEAST "correct" of the various rs232 translators floating around, but it's easy to wire up on a protoboard...
The 7404 can never produce the negative voltages required for the correct generation of RS232 signals. Consequently it won't work on all system requiring RS232. the fact that it does work on most is probably due to the fact that that the systems it works on have not got proper RS232 implementations on them either. The specification states that from +3V to -3V there is a dead zone where no transitions should occur, it is the hysteresis zone. So a real robust RS232 receiver should not work with a 7404. But most of the time you are connecting to crappy PCs that don't follow the RS232 spec.
As to an alternative there are lots of maxim chips. I use MAX202s because I have a hand full.
Earlier chips required larger capacitors in the 1.0uF range, newer chips need only 0.1 or smaller. These can be got as none polarised caps and small surface mount caps. (yes I know you can get 1uF ceramics now but this was not always the case).
Thanks Mike. I really do appreciate it. Well MAX232 seems pretty viable so I suppose I will make that my communication/interface chip.
I have one more question if you don't mind. I remember reading about AVR programmers that would presumably write the bootloader onto the Atmel Chip. However, I was wondering if there was any advantages of building an AVR programmer right onto the board. As in physically hardwired onto the Arduino board.
The MAX232 would still function as an interfacing chip but I was curious to whether or not 1.) it was possible, and 2.) if there were any advantages? Like updating the bootloader. That can be done vial serial/USB though right?
Also, can I used like an ATTiny or Mega with USB firmware to convert to USB instead of RS232?
There are two ways to program a Atmega chip, serial and high voltage. They are both explained in the data sheet. The only advantage of the high voltage option is that it can unlock some fuse pins that prevent it from being programmed in a serial form. Serial just uses the SPI pins, that is why there is a header on many arduino boards. So yes you can build a programmer in but you then loose those pins and you need another processor of some sort to act as a programmer.
can I used like an ATTiny or Mega with USB firmware to convert to USB instead of RS232
Having a programmer circuit on the board would allow you to burn the bootloader into bare chips (or reprogram the bootloader in non-bare chips.) (No, you can't do this over the serial port.) It adds cost and complexity by implementing something that is better done (IMO) using a separate circuit.
You can't "really" use an attiny with (fake) USB firmware because those don't adequately implement a serial port. You can, with some effort, use such an configuration to download code to your ATmega, but that's only a fraction of what the USB/Serial connection is usually used for.
What exactly are you trying to do, anyway? Part of the time it sounds like you're trying to minimize costs (no FTDI cable, for instance.) But then you'll start talking about using a max232 instead of a 7404, or adding extra programming circuitry... If this is your first effort in the arduino space, and a relatively early effort with electronics in general (as the level of your questions seems to indicate), I think you would be better off trying to more closely duplicate one of the common arduino designs...