Show Posts
Pages: 1 [2]
16  Using Arduino / General Electronics / Re: Input output interfacing on: February 14, 2013, 04:03:59 am
I've no idea what, if anything, is the symbol for a 4-20mA sensor. A current source makes sense in my head at least.

I guess if it was drawn correctly the + and - wouldn't actually be around it at all, the diagram only needs to show the 12V source and ground.

The documentation however only gives the electrical connections in terms of a + and - so it's good to have for reference.

In other news, 250ohm resisters ordered, I was shocked at how they start at £5 for such a tiny component. 0.1% tolerance and a specific use market do that i guess.
17  Using Arduino / General Electronics / Re: Input output interfacing on: February 13, 2013, 10:53:34 am
Here's the sensor i'm using:

http://www.michell.com/uk/products/pc33-52.htm

It says it should be supplied 5-30v for the mA output. I could use 5V from the arduino i guess, but i figured i'd already broken out the 12v supply to terminal blocks so that would be a better option.

Good point about the resisters on the Op Amp, i should have plenty of 10k resisters around, i used 51k originally because i bought a reel of a 100 of them!

Here is the Op Amp i currently have:
http://docs-europe.electrocomponents.com/webdocs/0e32/0900766b80e32147.pdf

I hope that's ok!

Sorry yup, drew up that too quickly, you're quite right about the polarity and serial/parallel, i'll edit the original post in case others look at it.

Cheers for the feedback so far.
18  Using Arduino / General Electronics / Re: Control Bulb Shutter with Arduino Mega on: February 13, 2013, 10:26:02 am
If it's anything like the canon remote control connection its just a switch that holds the shutter when closed.

Probably worth having a play just with the loose wires, only plugged into the camera, manually pulse it to see what happens.

I'd also endorse using an optocouple to get the job done. simplifies it a whole lot.
19  Using Arduino / General Electronics / Input output interfacing on: February 13, 2013, 09:56:05 am
Afternoon,

I've been researching 4-20mA inputs and PMW to 0-10v analog outputting and i just wanted to run it by the fine people of this board first to check I've not made any silly mistakes.

Firstly, 4-20mA; A Temperature and Humidity sensor, four wires:
Temperature +
Temperature -
Humidity +
Humidity -

Simple 250 ohm precision resisters in series with the sensors between the ground and the 12v supply i'm using.


Output; 0-5 PWM to 0-10V analog:

Simple RC filter to smooth the PWM then using a Op-Amp with a gain of two to double the output voltage.

fPWM = 488Hz
Duty step = 0% -> 99.9%
PWM voltage = 0v -> 5v
R=51k
C=1uF

Transfer Function
G_((s))=20/(s+20)
Cut off frequency
Fc=3.12Hz
Final Vout value (without ripple)
G(inf) = 4.995v
Peak-to-Peak ripple voltage
Vpk-pk = 0.05v
Settling time
Tr = 0.117 sec
20  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: February 06, 2013, 04:55:45 pm
I think the archive may be corrupted, or prehaps my computors playing up.
21  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: February 06, 2013, 03:58:14 pm
Ooh, thank you.
I'm using the Liquid Crystal varient.

I spent a few hours today just playing around with menu's. i must say i'm impressed, this is perfect for my project.

Now, only if i could get my damn weird bouncy rotary encoder working well! Accidentally bought a ABC switch type one.
22  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: February 06, 2013, 09:51:41 am
Afternoon, is it possible for a user to input a negative number in the M2_U8NUM or U32NUM elements?

e.g.
Code:
M2_U8NUM(el_u1, "c2", -20, 80, &n1);

I'm just playing around with the Rotary Encoder example at the moment to get to grips with this.

I'm trying to get a user to select a target temperature for a heater/cooler combination that can range from -20c to 80c.
23  Using Arduino / Programming Questions / Re: alarm.delay in libraries? on: January 31, 2013, 04:19:04 am
That's correct, in the readme of the timealarms library is states you may use Alarm.delay(0); if you only wish to check the alarm status and not cause a delay.
24  Using Arduino / Programming Questions / Re: TimeAlarm - timers over 24 hours? on: January 25, 2013, 11:55:29 am
I'm very new to this. As i said, my first real project. I've not had very much experiance with C++.

The majority of this code has been guess work as i dont actually have my arduino infront of me.

Looks like i missed the brackets off my attempts to call a function, so:
prg(); and restart(); i assume?

I missed updating the comment on the delay, it was a delay of 1000ms. Within the documentation is says you can use Alarm.delay(0) to just check the alarm status. prehaps i should raise it to 1 or 10 milliseconds?

prgStep incrementation changed to prgStep++;

I've bought a DS1307, it's in the mail so i'll impliment the code for that in the future. So far this is just one session of coding so plenty to do still!
25  Using Arduino / Programming Questions / TimeAlarm - timers over 24 hours? on: January 25, 2013, 11:27:49 am
Afternoon,

I'm making a PID controller for meat curing which will control temperature and humidity with a heater, cooler, humidifier and dehumidifier in a sealed and insulated container. The quirk being that the set point for the RH and temp will change every few hours which may be above or below ambient (hence needing all four output devices).

To provide timing for these changes i'm using the TimeAlarm library, however some of the time periods these set points will be held at for will exceed 24 hours. I'm unsure if its possible for the "timerOnce" command to accept values above 23?

I've been programming without an Arduino in front of me, and it's far from finished code, when i do get a chance to test it, the thought of doing so over 30 or so hours is not something i look forward too. So to save me some time and hopefully get it right first time, could this excellent community browse over my code. I expect there to be many errors! but it does compile.

This is the part that i think i'll probably have a problem with:
Code:
Alarm.timerOnce(hour() + prgHour,0,0, prg);
The aim is to reset the alarm that calls the function that this line is within, whilst updating it be called again x amount of hours on top of the current time. The problem being, if the current time was 11pm, and the next phase needed to run for 30 hours, would 23+30 = 2 days and 5 hours later or just a confused Arduino?


Full code:
Code:
#include <PID_v1.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <DS1307RTC.h>
#include <LiquidCrystal.h>
#include <Bounce.h>
#include <Encoder.h>
#include <Wire.h>

int RH, Temp, programme, prgStep, prgHour;

// Programme One - Snack Salami
int prgOne[] = {2, 36, 6, 6, 6, 6, 36, 144}; // Hours
int prgOneRH[] = {85, 92, 88, 85, 82, 80, 80, 80}; // Relative Humidity
int prgOneTemp[] = {22, 25, 22, 20, 17, 14, 12, 10}; // Temperature
// Programme Two - Saucison Sec
int prgTwo[] = {2, 48, 6, 6, 6, 12, 72, 144}; // Hours
int prgTwoRH[] = {85, 92, 88, 85, 82, 80, 80, 80}; // Relative Humidity
int prgTwoTemp[] = {22, 25, 22, 20, 17, 14, 12, 10}; // Temperature
// Programme three - Bacon
int prgThree[] = {2, 12, 3, 3, 3, 3, 3, 9}; // Hours
int prgThreeRH[] = {85, 92, 88, 85, 82, 80, 80, 80}; // Relative Humidity
int prgThreeTemp[] = {22, 25, 22, 20, 17, 14, 12, 10}; // Temperature
// Programme Four - Large Meat
int prgFour[] = {2, 60, 12, 12, 12, 12, 48, 132}; // Hours
int prgFourRH[] = {85, 92, 88, 85, 82, 80, 80, 80}; // Relative Humidity
int prgFourTemp[] = {22, 25, 22, 20, 17, 14, 12, 10}; // Temperature

//heater
double heInput, heOutput, heSetpoint;
double heKp = 1, heKi = 0.05, heKd = 0.25;
int windowSize = 5000;
unsigned long windowStartTime;
//cooler
double coInput, coOutput, coSetpoint;
double coKp = 1, coKi = 0.05, coKd = 0.25;
//humidifier
double huInput, huOutput, huSetpoint;
double huKp = 1, huKi = 0.05, huKd = 0.25;
//dehumidifier
double deInput, deOutput, deSetpoint;
double deKp = 1, deKi = 0.05, deKd = 0.25;

PID heater(&heInput, &heOutput, &heSetpoint, heKp, heKi, heKd, DIRECT);
PID cooler(&coInput, &coOutput, &coSetpoint, coKp, coKi, coKd, REVERSE);
PID humidifier(&huInput, &huOutput, &huSetpoint, huKp, huKi, huKd, DIRECT);
PID dehumidifier(&deInput, &deOutput, &deSetpoint, deKp, deKi, deKd, REVERSE);

void setup()
{
  Serial.begin(9600);
  setTime(0,0,0,1,1,13); // set time to Saturday 0:00:00am Jan 1 2013
  // setTime to be synced to RTC
  // Select program, map to 1,2,3 or 4
  programme = 1; // call function to get user input
 
  prgStep = 0;
  //Alarm.timerOnce(now() + prgHour,0,0, prg);
  prg;
 
  heInput = analogRead(0); // needs changing to input pin
  coInput = heInput;
  huInput = analogRead(0); // needs changing to input pin
  deInput = huInput;
 
  heSetpoint = Temp;
  coSetpoint = Temp;
  huSetpoint = RH;
  deSetpoint = RH;
 
  windowStartTime = millis();
 
  heater.SetOutputLimits(0, windowSize);
 
  heater.SetMode(AUTOMATIC);
  cooler.SetMode(AUTOMATIC);
  humidifier.SetMode(AUTOMATIC);
  dehumidifier.SetMode(AUTOMATIC);
  //output RH and Temp values to PID and initilise
}   


void  loop(){ 
  Alarm.delay(0); // wait one second between clock display
 
  heInput = analogRead(0); // needs changing to input pin
  coInput = heInput;
  huInput = analogRead(0); // needs changing to input pin
  deInput = huInput;
 
  heater.Compute();
  cooler.Compute();
  humidifier.Compute();
  dehumidifier.Compute();
  unsigned long now = millis();
  if(now - windowStartTime>windowSize){ //time to shift the Relay Window
    windowStartTime += windowSize;
  }
  if(heOutput > now - windowStartTime){
    digitalWrite(1,HIGH); // Needs changing to output pin
  }
  else{
    digitalWrite(1,LOW); // Needs changing to output pin
  }
  analogWrite(1, coOutput); // Needs changing to output pin
  analogWrite(1, huOutput); // Needs changing to output pin
  analogWrite(1, deOutput); // Needs changing to output pin
 
  //write statistics to the screen and monitor buttons for exit (with conformation)
  //feedback current step, current temp, target temp, current RH, target RH, time left total, time to next step
}

void restart(){
  RH = 80;
  Temp = 10;
  programme = 2;// call function to get user input
  //setTime(0,0,0,1,1,13);
  prgStep = 0;
 
}
void prg(){
  if(prgStep == 8){
    restart;
    return;
  }
  else {
    switch (programme) {
      case 1:{ // Programme One - Snack Salami
        prgHour = prgOne[prgStep];
        RH = prgOneRH[prgStep];
        Temp = prgOneTemp[prgStep];
        break;
      }
      case 2:{ // Programme Two - Saucison Sec
        prgHour = prgTwo[prgStep];
        RH = prgTwoRH[prgStep];
        Temp = prgTwoTemp[prgStep];
        break;
      }
      case 3:{ // Programme three - Bacon
        prgHour = prgThree[prgStep];
        RH = prgThreeRH[prgStep];
        Temp = prgThreeTemp[prgStep];
        break;
      }
      case 4:{ // Programme Four - Large Meat
        prgHour = prgFour[prgStep];
        RH = prgFourRH[prgStep];
        Temp = prgFourTemp[prgStep];
        break;
      }
    }
    Alarm.timerOnce(hour() + prgHour,0,0, prg);
    prgStep = prgStep + 1;
    Serial.println("Program ");
    Serial.print(programme);
    Serial.print(". Step ");
    Serial.print(prgStep -1);
    Serial.print(" of 8.");
  }
}
26  Using Arduino / Programming Questions / Re: Temeratures control with outputs on: January 25, 2013, 10:59:41 am
If you want to be fancy you could use the PID library to give this an element of smart control.

Perhaps overkill for relays, but it'll be accurate.

Library:
http://playground.arduino.cc//Code/PIDLibrary

Relay implementation:
http://playground.arduino.cc//Code/PIDLibraryRelayOutputExample
27  Using Arduino / Displays / Re: LCD Choices and Compatability on: January 24, 2013, 10:59:32 am
Thank you Floresta.

I think it may be best for me to start out with a parallel connection then experiment with a serial one in the future, or perhaps a graphical display if i'm feeling fancy.

Right, time to order things and get working on a menu. Already had a play with my rotary encoder =D
28  Using Arduino / Displays / LCD Choices and Compatability on: January 24, 2013, 04:04:33 am
Morning,

I'm starting my first major project, to build a PID controller for temperature and humidity. That parts going ok, but i'm confused about which display to pick, so many choices, so many different controllers.

I'm within the UK and my preferable supplier is RS. I'm ideally after a 20x4 monochrome LCD. If possible controlled by serial connection, i'm using a mega so its no problem is its not.
Unfortunately they don't seem to sell any HD44780 controlled displays.

This is the closest I've manage to find:
http://uk.rs-online.com/web/p/lcd-monochrome-displays/5326818/

It's controlled by a ST7066U. Pin outs on page 9 of the datasheet:
http://docs-europe.electrocomponents.com/webdocs/06dd/0900766b806dda1c.pdf

Other controllers available:
NJU6450
NT7603H
PCF 2119RU/2/F2 COG
RW1067
S1D13700
SED1520
SPLC780D
ST 7565R
ST7036
ST7065
ST7066U
ST7565P
ST7565R-G
T6963C
UC1610

Can i get recommendations on whats compatible and has good library support?
Pages: 1 [2]