Yes it was from a direct result of this thread See first post.
Iām guessing youāll want to stay to the high end 13.5. Having it set to 41.5 probably yields 13.5 max anyway so I donāt know if there will be much change in how it responds. Comparing to the old way of 41.5 single channel/conversion might be interesting though.
@BDub correct after trying out with 1.5, 7.5 & 13.5, readings are pretty much similar to 41.5 sampling time. But I havenāt tested it comprehensively as you did in your first post. Would you like to repeat the test and see how the use of Dual ADC compares with the single ADC in terms of input impedence and publish the result.
Thanks,
Satish.
@BDub, Default sampling time is now set to 7.5 and added a new setADCSampleTime() which can be called in setup() to override the default ADC Sampling time.
Ahh cool! I was totally going to suggest that since it seems like some people might need faster sampling and can take care of making sure the input impedance is low enough to get good readings. Iāll try to get some testing in tonight.
Well it was very nice to return home and find that the ADC issues are solved - thanks guys. The new code gives excellent results with my 50Hz measurements so I can get back to the Energy Monitor development.
Iām getting around a 35uS conversion time with 1_5 set in setADCSampleTime() and 40uS with the default 7_5 so there is not a lot of difference. If I want faster sampling for my next project Iāll go back to the pre-DMA version of the code which was much faster but make sure I take care with input impedance.
Can someone help me out with the circuit of the temperature sensor interfaced with spark core? My program is correct but some problem in circuit.? Reply ASAP
// -----------------
// Read temperature
// -----------------
// Create a variable that will store the temperature value
int temperature = 0;
void setup()
{
// Register a Spark variable here
Spark.variable("temperature", &temperature, INT);
// Connect the temperature sensor to A7 and configure it
// to be an input
pinMode(A7, INPUT);
}
void loop()
{
// Keep reading the temperature so when we make an API
// call to read its value, we have the latest one
temperature = analogRead(A7);
}
How to read the data:
voltage = (sensor reading x 3.3)/4095
Temperature (in Celsius) = (voltage - 0.5) X 100
The API request will look something like this:
GET /v1/devices/{DEVICE_ID}/temperature
# EXAMPLE REQUEST IN TERMINAL
# Core ID is 0123456789abcdef
# Your access token is 123412341234
curl -G https://api.spark.io/v1/devices/0123456789abcdef/temperature -d access_token=123412341234
Iām also having trouble reading temperature from my Spark Core. I have a Spark Maker kit and am using the TMP36 sensor and one of the included 10nF caps. My circuit is set up just as in the Spark documentation: http://docs.spark.io/examples/#measuring-the-temperature
Iām using the Tinker firmware, and my raw analog readings vary between 700 and 800 (which equates to temps of 43F to 58F). Iām testing in my house, and a digital thermometer next to my Spark Core reads a constant 77F.
Are such wild reading expected or normal with the Tinker firmware?
After a bit more tinkering (mostly using shorter leads & wires), Iām getting accurate temp readings consistently for a few seconds interspersed with a few seconds of the unusually low readings. For example, the temp input (pin A7) will read 931 for 5-6 seconds, then 765 for 2-3 seconds, then back to 931 for 2-15 seconds, then back to 765 for 2-10 seconds, and so onā¦
Is this just how it is, and I need to filter out/ignore the obviously incorrect values? Or is there more I can do to troubleshoot?
From the timestamp you can see I read once every second, and they are all very close to each other, except the one I have marked. Right after that single reading that is way off, it goes back to where it was before.
After logging that I tried to search the forum and found this thread about things to do to make it more stable, so I changed from the 3V3 pin to the 3V3* and started the logging again, and here is the result
Again I got some good readings, but still once in a while it is off, this time way off.
I got the sensor connected to A7, a capacitor between the analog input and GND, using the 3V3* pin and reading once every second (canāt bump that up more without starting to affect the project).
What else can I do? It is not like I got some unstable readings, the reading that is off happens around once every 150-200 reading.
@Mikey, you need some super hacker debugging type wizard to help you⦠I wish I could be everywhere, all of the time o_~ What is happening every 2.5 to 3.3 minutes that could be causing a glitch in your power? This could easily account for this really odd reading. More info about your entire code and setup will help troubleshoot this issue as well.
@Mikey Are you using the default Tinker firmware to get these values?
@BDub I noticed (with Tinker) that the further away I am from my wifi access point, the less reliable my temp readings. Meaning that the completely incorrect readings show up more frequently. If I have my Spark Core in the same room as my wifi AP, the incorrect readings are far less frequent.
So Iām guessing that the harder that the wifi chip has to work (whether it be reconnecting or re-sending data), the better chance it has of screwing with analog readings. Iāve also tried the VoodooSpark firmware, and get similar results (although slightly more reliable at longer ranges)