Few collected questions about the Arduino

Hi folks, so I have had some random questions that I had for a while about the Arduino and was wondering if you can answer them:

  1. If the Arduino is powered by a 9V battery, will the Arduino run fine till the battery drops to 4.99V? ( Usually a device that runs on 9V starts to die when the voltage hits around 8.5 V; thats why I asked).

  2. When you monitor the I2C bus between 2 Arduinos, you see that the master is sometimes 'reading' something from the slave even if there is absolutely no read statement in the sketch. What is the master reading and what info can we gather by analyzing the 'read' data?

  3. I see ATMega328Ps in DIP-28N format. I also see them in 32 pin TQFP-3 form. People say that both are the same. If they are the same, then why does one have 28 pins and another have 32 pins.

  4. When I call SoftwareSerial.h or Wire.h or any other header library in my sketch, does the entire library get uploaded into the ATMega 328P chip or do only certain needed elements inside the library that are needed for my sketch get uploaded.

  5. I read that the UNO has 32K flash memory. Does it help conserve flash memory space if I use variable names like 'abf=3' rather than something like theValueOfThePinComingOutOfTheOtherSideOfTheBreadBoard=3' ?

  6. Are big DIP form chips and small TQFP-3 chips electrically the same always?

  7. Why do some libraries have a notepad file with a .h extension and some have a .cpp extension? How would I know when to use what?

Thank you for your replies!

  1. 9V goes to Vin, not to 5V. The spec says 7V (6V absolute minimum) for Vin so it will not work when the battery goes down to 5V.
  2. No idea, do you have an example of an I2C device where this happens.
  3. The 32 pin package has two additional analogue inputs (that can't be used for digital IO). I think it also has an additional Vcc and/or GND; check the datasheet to see the exact difference.
  4. Only what is needed; the full library will be compiled but the linker will throw away what is not needed.
  5. No, variable names don't exist in the final executable.
  6. Not sure for the earlier 328P the die is the same.
  7. Libraries usually consist of one or more .h files and one or more .cpp files. The .h file that you include tells the compiler which functions and variables are there, the .cpp file contains the implementation of the functions. You only include the .h file.

===
Your topic has been moved to a more suitable location on the forum. Introductory Tutorials is for tutorials that e.g. you write, not for questions :wink:

2 Likes

sterretje answered all your questions. I can add to that, that as far as I know the chip die is the same. It is just the plastic package, DIP-28 or TQFP 32, that is different.

The DIP-28 does not have enough pins for A6 and A7, so they don't have pins to the outside world. However they are still inside (in the chip die), it is even possible to read noise from them.

A 9V battery voltage below 9V indicates an emptied battery that can not provide enough energy to an Arduino. Use a better suited power supply.

The 9v battery question is more complicated…
Connected to Vin, there will be regulated 5v to the avr until the battery reaches about 7 to 8v (depending on exactly which regulator chip your board has.) But the avr will run at less than 5v, so in theory if the regulator supplies Vin-2V, the avr might run ok until the battery is down around 5 to 6 (avr min voltage is something like 1.8V, but not at 16MHz.)

A 9V battery outputting 7V is pretty much “dead”

1. (1) 9V Battery is considered to be useable upto terminal voltage of 8.18V (calculation: Ni-Cd Battery Cell Reference. Float Volt: 1.1V, Final Volt: 1.0V.)
(2) Safe operating voltage of ATmega328P MCU at 16 MHz is 4.5V. UNO's on-board AMS1117-5.0 type fixed voltage regulator is gurantted to maintain 15V/5V regulation at 800 mA current.

2. I never experinecd such event.

3. 28-Pin DIP package vs 32-pin Flat ackage:
IO line: 23 / 23
ADC: (6)/(6) + 2
Vcc: 1/2
AVcc: 1/1
AGND: 1/1
DGND: 1/2
AREF: 1/1

Total: 28/32

4. (Quoted fro Post-2) "Only what is needed; the full library will be compiled but the linker will throw away what is not needed."

5. A variable will not be saved in flash unless qualified by keywords const PROGMEM. For example:

byte const PROGMEM abf = 3;

Regardless of the length of an identifier/variable name, it is always evaluted to an 16-bit (12-bit?) unique RAM location address (if saved in RAM) or 14-bit flash location address (if saved in flash).

6. Yes!

7. (Quoted from Post-2)" 1. Libraries usually consist of one or more .h files and one or more .cpp files. The .h file that you include tells the compiler which functions and variables are there, the .cpp file contains the implementation of the functions. You only include the .h file."

1 Like

The output of the 5V regulator is a minimum of about 1V lower than the battery voltage. The protection diode for the power jack takes away another 0.6V. The ATmega328P is designed to run on as little as 3.8V (at 16 MHz). The Arduino should continue to work correctly with the battery as low as 4.8V if you use the Vin pin and 5.4V if you use the power jack.