Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / General Electronics / Re: Uno with Motor Shield - problem reading potentiometer values on: June 28, 2014, 04:25:27 pm
Is the motor shield the official one? Because if it is, then A0 and A1 are connected to the current sensing on the motor driver chip. Try using A2 and see if it makes a difference.
2  Using Arduino / Programming Questions / Re: NOOB Servo problem on: June 06, 2014, 04:21:01 pm
It could also be because of a not well debounced button...
3  Using Arduino / Project Guidance / Re: Quadcopter on: May 20, 2014, 02:48:30 pm
You can check on the multiwii code for stabilization purposes, runs very well on a 328p:http://www.multiwii.com/
4  Products / Arduino Due / Re: Nothing appears on arduino DUE screen on: March 12, 2014, 06:35:52 am
If you use the native port you muste use "SerialUSB" for communication with the computer.
5  Products / Arduino Due / Re: Arduino DUE PWM 60kHz Problem on: February 27, 2014, 05:12:38 am
If you are trying to control a servo or an ESC, maybe you should use the servo library provided with the arduino IDE:http://arduino.cc/en/Reference/Servo
6  Using Arduino / Programming Questions / Re: digitalRead question! on: February 26, 2014, 01:17:12 pm
Try something like this:
Code:
int couter=0;
boolean pressed=false;

if(digitalRead(pin)==HIGH&&pressed==false)
{
     counter++;
     pressed=true;
}
if(digitalRead(pin)==LOW&&pressed==true)
{
     pressed=false;
}
7  Using Arduino / General Electronics / Re: 5v wall wart as digital input on: February 17, 2014, 01:19:11 pm
@Zapro, Have you ever heard about switching power supplies? Almost every 5V Wall-wart now uses switching mode power suply, and the main "only" goes through an inductor and a diode. Still it is safe...
8  Using Arduino / Installation & Troubleshooting / Re: How to use external editor on: February 17, 2014, 08:17:43 am
Thanks for your answer smiley
9  Using Arduino / Installation & Troubleshooting / How to use external editor on: February 17, 2014, 05:54:56 am
Hi, I'd like to use an external editor with the arduino IDE, but when I click the "use external editor" in the settings window, all it does is disabling the coding area, I can't modify the content, nor paste code in it.
Can anyone guide me on how to actually use an external editor with the IDE?
10  Using Arduino / Programming Questions / Re: [SOLVED]Calculating temperature from thermistor on: February 15, 2014, 05:24:50 pm
It is a modified version of the original code that didn't worked.
The actual working code without the debugging output would be
Code:
#define cA1 0.003354016
#define cB1 0.000256985
#define cC1 0.000002620131
#define cD1 0.00000006383091
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(calctemp(analogRead(0)));
  delay(3000);
}

double calctemp(int value)
{
  return (pow((cA1+cB1*log(((10240000.0/(double)value)-10000)/10000.0)+cC1*pow(log(((10240000.0/(double)value)-10000)/10000.0),2.0)+cD1*pow(log(((10240000.0/(double)value)-10000)/10000.0),3.0)),-1.0)-273.15); 
}
11  Using Arduino / Programming Questions / Re: [SOLVED]Calculating temperature from thermistor on: February 15, 2014, 04:42:08 pm
I forgot to take that of, it was when I only got "nan" output ant though maybe there was an error in the data type...
anyway that print is always zero in the actual code since the calctemp() function does not return anything ...
12  Using Arduino / Programming Questions / Re: Calculating temperature from thermistor on: February 15, 2014, 04:04:29 pm
I re did the maths and found where the error was, now I get correct values for the temperature smiley

(code if anyone want to look at it)
Code:
#include <avr/math.h>
//double calctemp(int value);
#define cA1 0.003354016
#define cB1 0.000256985
#define cC1 0.000002620131
#define cD1 0.00000006383091
double temp;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  temp=calctemp(analogRead(0));
  Serial.println((double)temp);
  delay(3000);
}

double calctemp(int value)
{
  double temp;
  Serial.print("value: ");Serial.println(value);
  Serial.print("r/ r ref:");Serial.println(((10240000.0/(double)value)-10000.0)/10000.0);
  Serial.print("a1:");Serial.println(cA1,5);
  Serial.print("b1*log(...):");Serial.println(cB1*log((((10240000.0/(double)value)-10000.0)/10000.0)),5);
  Serial.print("c1*log^2(...):");Serial.println(cC1*pow(log(((10240000.0/(double)value)-10000)/10000.0),2),5);
  Serial.print("d1*log^3(...):");Serial.println(cD1*pow(log(((10240000.0/(double)value)-10000)/10000.0),3),5);
  Serial.print("sum:");Serial.println(cA1+cB1*log(((10240000.0/(double)value)-10000)/10000.0)+cC1*pow(log(((10240000.0/(double)value)-10000)/10000.0),2.0)+cD1*pow(log(((10240000.0/(double)value)-10000)/10000.0),3.0),5);
  Serial.print("final:");Serial.println(pow((cA1+cB1*log(((10240000.0/(double)value)-10000)/10000.0)+cC1*pow(log(((10240000.0/(double)value)-10000)/10000.0),2.0)+cD1*pow(log(((10240000.0/(double)value)-10000)/10000.0),3.0)),-1.0)-273.15);
  return temp;
 
}
13  Using Arduino / Programming Questions / Re: Calculating temperature from thermistor on: February 15, 2014, 01:26:43 pm
@mmcp42 I'll try that, thanks smiley
14  Using Arduino / Programming Questions / Re: Calculating temperature from thermistor on: February 15, 2014, 01:25:04 pm
it's like that:
15  Using Arduino / Programming Questions / [SOLVED]Calculating temperature from thermistor on: February 15, 2014, 12:14:45 pm
Hi, I want to get the temperature from a thermistor, so I made a simple a simple voltage divider (5V to thermistor,  10k between thermistor and ground, analogRead() between the 10k resistance and  the thermistor.
The nominal value of the thermistor is 10K too,
I looked the datasheet (http://www.vishay.com/docs/29049/ntcle100.pdf) and found a formula to get the temperature from the thermistor resistance:
Code:
K=3977
r ref=10k
A1=3.35401e-3
B1=2.56985e-4
C1=2.620131e-6
D1=6.383091e-8

T=(A1+B1*ln(r/r ref)+C1*ln^2(r/r ref)+D1*ln^3(R/r ref))^-1
and I found that using analogRead(), the resistance of the thermistor is
Code:
R=((1024-val)*10000)/val

Then I made a simple sketch to print the temperature on the serial monitor:
Code:
#include <avr/math.h>
//double calctemp(int value);
double temp;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  temp=calctemp(analogRead(0));
  Serial.println((double)temp);
  delay(1000);
}

double calctemp(int value)
{
  double temp;
 temp=(1.0/(0.00335401+0.000256985*(double)log((((double)((1024-value)*10000)/(double)value))/(double)10000)+0.000002620131*(double)pow(log((((double)((1024-value)*10000)/(double)value))/(double)10000),2.0)+0.00000006383091*(double)pow((double)log((((double)((1024-value)*10000)/(double)value))/(double)10000),3.0)));
  return temp;
  
}

But the problem is that I only get "nan" as output...
Has anyone a clue of what might be wrong?
Pages: [1] 2 3 ... 6