I am just wondering about the internal voltage reference which is usually 1.1V ATmega168/328 chips, is that present in the spark core?
The reason I ask is because I will be running the spark core on battery, and I will like to run an accelerometer on it for a week. As the battery starts getting emptier, the reference voltage (~3.3V, which is not accurate to begin with) will probably start dropping. This might give me more and more inaccurate results by the day (I need it to be very precise for my purposes), so I would need a reference voltage which I can trust and I can adjust my accelerometer readings according to.
Does anyone know if there is an accurate internal reference? If not, how could you do it?
The ADC voltage reference on the Spark core is a filtered version of the 3.3V supply. If you are using USB or VIN to power the core, then this 3.3V comes from the on-board 3.3V regulator. If you are supplying your own 3.3V source, the voltage reference will only be as accurate as your supply.
If you add an external 1.2V reference IC like an LM185 series part, you can measure that on one ADC pin and measure your signal on another and use the ratio of the two to determine a more accurate value.
The 3.3V* pin on the spark core is more stable than the others, it provides a great reference for sensor readings, especially analog. http://docs.spark.io/examples/ Check out the temperature example.
Also I was looking at a spec sheet (http://www.ti.com/lit/ds/snvs741f/snvs741f.pdf), I am very new to electronics but from what I can see you only need to connect at 500k resistor between the battery and one of the pins of the IC, one pin goes to GND and one pin is the output 1.2V. Is that right? Again as I said, I know very little about this.
Also once you have an accurate 1.2V reference you can feed it through and external AREF. Which pin would that be on the board?
Yes, that part will work great and is easy to hook up as you found out.
You should know that the ARM processor on Spark core only works down to 2.4V.
You cannot change the AREF on the Spark core. What I suggested is making two measurements:
Make your normal sensor measurements on one channel (let’s say A0)
Then right after that read the voltage on the 1.2V reference on say A1
Now you have two numbers both of which vary with the supply voltage you are driving on the 3.3V core pin, but the second one would be constant if the supply was perfect.
So A1 would be 1.2/3.3*4095 = 1489 when the battery is full at 3.3V.
But when the supply voltage drops to say 3.1V, then A1 would read 1.2/3.1*4095 = 1585
So the ratio of the current measurement of the 1.2V reference to the full scale value of 1489 tells you the current battery voltage relative to the 3.3V nominal calculated above.