Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 11:17:24 am
Thanks, I have done that. It is also in my last posting smiley-wink
2  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 09:53:59 am
I think I found the problem. I tried to power the second amplifier from a breadboard power supply with common ground with the Arduino. Then I wanted to see if the DO or CLK line causes the errors. What I found was, that only connecting the power pins, even from another supply, where enough to trigger the problem. So what I found was that the housings of the two thermocouples were electrically connected via an aluminium tube for ventilation - though I have to admit that I didn't know they were not allowed to.
 No, after I isolated one of the couples and made sure that not even the braided metal covers of the cables touch, the isolated one works properly. The other one, which goes into the metal exhaust pipe, still gives errors about every second reading. I can live with that, if I have to.

@Riva:
The communication seems to work fine, since I can always read the internal temperature.
3  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 09:11:26 am
@riva
Yes, I have. Also, the problem already starts when I just connect a second element in addition to the first one.

@robtillaart
Still unlikely with 1.5mA. But Ill test it. I will also have a look which line exactly causes the malfunction.
4  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 08:13:27 am
The datasheet says max I_CC is  1500uA ... Also, my USB supply is rated for 2A.
5  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 08:05:01 am
What I meant was: If there is short or open circuit, it should be be working in a single TC setup smiley
6  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 07:54:52 am
I did more testing and indeed, the problem starts as soon a I connect the second amplifier, despite the fact that
http://learn.adafruit.com/thermocouple/f-dot-a-q
claims it is possible with shared pins.
I have attached a photo of my setup, in case I am misunderstanding something completely.
7  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: January 01, 2014, 06:56:24 am
@robtillaart
readInternal reads the internal thermometer of the chip. That always works for me in any setup. I don't think it is inconsistent not to display errors in the external thermocouple when reading the internal one.
Anyway, that was interesting information. Thanks! However, all these things should lead to errors independent of the way I read the sensors, shouldn't it?

@michinyon
I thought I do understand SPI. Is there anything in the code that says I don't?

Happy new year, BTW smiley
8  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: December 31, 2013, 01:27:26 pm
Yes, I'll test that next year. Guests are about to arrive smiley

Here is a link to the library:
https://github.com/adafruit/Adafruit-MAX31855-library

The example says:
Code:
if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {

Here is a datascheet for the chip on the breakout:
http://www.adafruit.com/datasheets/MAX31855.pdf
and here are the layout files for the breakout:
https://github.com/adafruit/Adafruit-MAX31855-breakout-board
9  Using Arduino / Sensors / Re: A lot of errors with two thermocouples on: December 31, 2013, 12:43:09 pm
Thanks anyway smiley  I hoped for someone with an easy anther, since I always have to lie in front of my fireplace for testing smiley

So, what I did now:
- Test a single thermocouple with serial example.  Worked like a charm, so those things are not the problem by themselves.
- Add all the libraries to the code. Didn't change anything, still worked.
Back to the original setup:
- Disconnected one amplifier physically: other one still has errors
- Removed one amplifier from the code: other one still has errors
- Physically removed OLED: still errors
- Removed OLED from the code: still errors

I'm starting to think it's something in the wireing ...
10  Using Arduino / Sensors / A lot of errors with two thermocouples on: December 31, 2013, 08:08:05 am
Hi,
 I am running two of these:
http://www.adafruit.com/products/269
with these:
http://www.ebay.com/itm/K-Type-10cm-Probe-Thermocouple-Temperature-Measurement-Sensor-70cm-/310570751975?pt=LH_DefaultDomain_0&hash=item484f7597e7
and an SPI OLED display.

The wireing is quite straightforward:
Code:
//SPI
const byte SPI_CLK = 13;
const byte SPI_MOSI = 11;
const byte SPI_MISO = 12;

//OLED
const byte OLED_CS = 7;
const byte OLED_DC = 8;
const byte OLED_RESET = 9;

//Thermocouple
const byte TC1_CS = 2;
const byte TC2_CS = 4;

That is, they all share CLK, the two thermocouple amplifiers share MISO. The full code (with some preparations for further functionality)  is below.

Now, unfortunately, I get alot of NAN from the thermocouples. Every maybe 30 seconds, a reading is successful, and the temperature is plausible. I would assume that the cheap thermocouples are just garbage, but the strange thing is: successful reading are highly correlated. They haven at the same time or at least within one or two seconds in 95% of the time. That doesn't seem to be something that happens through defective tp ... any idea, anyone?
If I just disconnect one thermocouple, it is not better in any way.


Code:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_MAX31855.h>
#include <Servo.h>
#include <CapacitiveSensor.h>

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

//SPI
const byte SPI_CLK = 13;
const byte SPI_MOSI = 11;
const byte SPI_MISO = 12;

//OLED
const byte OLED_CS = 7;
const byte OLED_DC = 8;
const byte OLED_RESET = 9;

//Thermocouple
const byte TC1_CS = 2;
const byte TC2_CS = 4;

//Servo
const byte SERVO = 4;

//Buttons
const byte BUT_SEND = 5;

//Adafruit_SSD1306 display(SPI_MOSI, SPI_CLK, OLED_DC, OLED_RESET, OLED_CS);
Adafruit_SSD1306 display(11, 13, 8, 9, 7);

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16
static unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

Adafruit_MAX31855 thermocouple[] = { Adafruit_MAX31855(SPI_CLK, TC1_CS,
SPI_MISO), Adafruit_MAX31855(SPI_CLK, TC2_CS, SPI_MISO) };
double temp[] = {0,0,0,0};

CapacitiveSensor button[] = {CapacitiveSensor(5,A0),\
                             CapacitiveSensor(5,A1),\
                             CapacitiveSensor(5,A2),\
                             CapacitiveSensor(5,A3),\
                             CapacitiveSensor(5,A4),\
                             CapacitiveSensor(5,A5)};
boolean buttonState[]  = {false,false,false,false,false,false};
boolean buttonAction[] = {false,false,false,false,false,false};
long    buttonTime[]   = {0,    0,    0,    0,    0,    0};
const byte BUTTON_N = 6;
const byte DEBOUNCE_DELAY = 20;

void setup() {
  Serial.begin(9600);

  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  display.clearDisplay();
}

void loop() {
  //controlButtons();
  displayTemperatures(0,2);
  delay(1000);
}

void displayTemperatures(byte l1, byte l2) {
  double tempNow[] = { 0,0,0,0 };

  boolean error[]={false,false};

  display.setTextSize(1);
  display.setTextColor(WHITE);

  for(int i=0; i<2; i++)
  {
    tempNow[2*i] = thermocouple[i].readCelsius();
    if(!isnan(tempNow[2*i]))
    {
      temp[2*i]=tempNow[2*i];
    }
    else
    {
      error[i]=true;
    }

    tempNow[2*i+1] = thermocouple[i].readInternal();
    if(!isnan(tempNow[2*i+1]))
    {
      temp[2*i+1]=tempNow[2*i+1];
    }
    else
    {
      error[i]=true;
    }
  }

  display.clearDisplay();
  for(int i=0; i<2; i++)
  {
    display.setCursor(2*10,i*2*10);
    display.print(temp[2*i]);
    display.print("/");
    display.print(temp[2*i+1]);
    display.print("      ");
    display.setCursor(0, 2*i*10);
    if(error[i])
    {
      display.print("E");
    }
    else
    {
      display.print(" ");
    }
  }
  display.display();
}

11  Using Arduino / Project Guidance / Re: Guidance on if this could work, Aquarium lights with extras. on: December 25, 2013, 06:21:41 am
Color temperature isn't a good quantity for LEDs in this case, because they don't have a continuous spectrum. Color temperature is only really good if you have light that emerges from heat, like classic light bulbs, or if you want to characterize the impression on the human eye. The first thing is not the case here, the other is not your only concern. What you want are wavelengths that can be used by the plant for photosynthesis.
I don't know exactly what would be the best choice. There is some material on the optimal lighting, but that is just for efficiency  and looks terrible, because it only consists of red and blue. 
Just keep in mind how LEDs work and how plants work and that not every LED will be optimal for plant growth. See how others were successful and stick to their LEDs.
12  Using Arduino / Programming Questions / Re: How to open two relays at the same time? on: December 20, 2013, 02:50:34 am
Yes, you can set the two pins HIGH and safe a timestamp (millis()), then you just let the loop run and set the respective pins to LOW as soon as timestamp+d/e is smaller than millis().
This has the additional advantage that you processor is free for other tasks in the meantime, instead of being stuck in a delay.

Do you want to try writing that code yourself? Post it afterwards, if you want, so we can check it.
13  Using Arduino / Project Guidance / Re: LED Strip project for my son to be born Feb 2nd. on: December 19, 2013, 05:02:24 am
Why should those be better? I cannot really see the strip itself, but the controller looks exactly like the cheapest China crap you get everywhere.
14  Using Arduino / Project Guidance / Re: Guidance on if this could work, Aquarium lights with extras. on: December 18, 2013, 07:53:00 am
Did you consider the spectrum of the LED light regarding you plant growth?
15  Using Arduino / Project Guidance / Re: Need help for my uni final project on: December 18, 2013, 07:20:57 am
Any board can control relays. That is not you main concern, as it was already explained.

Having said that, Wolfram Mathematica recently came to the Pi, for free as far as I understood. Perhaps that is helpful for you.
Pages: [1] 2 3 ... 6