I'm using an LM35 with my Mega 2560 to read analog temperature voltages. I'm using the analogReference(INTERNAL1V1)
to read in order to get precision down to a tenth of a degree.
I'm also using analogWrite
to output a signal based on PID loop calculations to a Peltier sensor. When I do this, I switch back to analogReference(DEFAULT)
.
I read about how to properly switch between reference voltages (read in a garbage value, then wait a some milliseconds), and yet I've noticed my power jack getting hot (more than normal, in just ~30 minutes.) I do not have any hardwired connections going to the AREF pin.
Finally, I'm using a Trinamic TOS-100 motor control card for another part of this project. I wanted to avoid using two power cables (one for the Mega, one for the TOS), so I put a solder blob over the tiny SJ1 jumper that bridges the Mega external input (I'm using 12V) to the VIN pin of the TOS.
Two questions:
-
Do I need to switch the analogReference back to DEFAULT if I'm writing to a pin? I only need to use the 1.1V to the one pin.
-
Whatever the case, would it affect the heat generated at the power jack (or generated in the board, felt at the power jack?)
The analog reference has nothing to do with analogWrite. No matter what the analog reference is set to, analogWrite will still output 0 to 5V PWM pulses. So no need to switch.
Great, I took that out in the code. I decided to just reference 1.1V every time I take the reading (going from INTERNAL1V1 to DEFAULT in this one particular reading function), but the heat was still heavy.
So I returned back to my original sketch with the " temp = (5.0 * analogRead(tempPin) * 100.0) / 1024; "
equation, no 1.1V references. The heat is far less than before, even though the accuracy is heavily reduced.
Prior to that, when I would switch references, I put delay(20)
(sometimes delay(50)
)....is that an appropriate amount of time? Or could that have been the reason for the heat?
I seriously doubt that the heat issue is connected to the use if the 1.1V reference. What component is getting hot? The 5V regulator? Can you provide a schematic of your project? What else is connected to the Mega? It may be that the regulator (on the Mega) has to dissipate a lot of power to bring the 12V down to 5V with the current required by the components connected to the Mega. Power dissipated by the regulator is 12V - 5V * current drawn from the 5V rail.
lennon-pledge:
I wanted to avoid using two power cables (one for the Mega, one for the TOS), so I put a solder blob over the tiny SJ1 jumper that bridges the Mega external input (I'm using 12V) to the VIN pin of the TOS.

Stepper motors can take pretty huge amounts of current, you're probably exceeding the spec of the barrel connector.
Use separate power wires.
Thanks for the suggestion...ended up desoldering the blob, put the power chord back in the Trinamic barrel jack. The heat reduced considerably. Given all the functions it has, the Mega is holding up well at this point.
The PID loop I had constructed worked for one particular physical setup. The issue I wrote about arose during a different physical setup (larger chamber, different air flow.) So I put it back to the original and everything is working...the new setup is the problem.