Show Posts
Pages: [1] 2 3 ... 20
1  Using Arduino / Programming Questions / Re: digitalRead question on: August 13, 2014, 03:54:53 pm
yes sorry it is  ||
any other ideas?   
2  Using Arduino / Programming Questions / digitalRead question on: August 13, 2014, 03:31:26 pm
hi there I have this code what works fine

Code:
if ((FalSafeValue < 359 && (failFlag == false)) {

but I would like to add  a diditalRead in this.I have had a go in the code below but now that piece of the code doesn't seem to work at all now.

Code:
if ((FalSafeValue < 359) ll !digitalRead(tempFalSafe) && (failFlag == false)) {

what have I done  wrong?
3  Using Arduino / General Electronics / Re: battery mAh tester on: August 03, 2014, 03:55:55 am
Make i am testing with is ultra max np7-12, 12volt, 7Ah, gel sell lead acid
I have to of them linked in series to give me a 24v output
4  Using Arduino / General Electronics / Re: battery mAh tester on: August 03, 2014, 03:06:15 am
Yes I did mean 7am
So the general concessive is to switch off the wains to it check the voltage and then put it under a load and see how far the voltage drops?

On the other hand you can buy a battery testers which can test the Am within about 20s or so, so how do these things work?
Or are they not particularly accurate? But hope not as some of them are over £200
5  Using Arduino / General Electronics / battery mAh tester on: July 31, 2014, 03:55:00 pm
hi there, I have a project  which uses two 7 mAh batteries for mains failure. These are being constantly charged. What I would like to do is some sort of battery test on them on a push of a button. I thought the best way to test them is a mAh test? But I have seen others that have done this but they take a fully charged battery and discharge it all the way down but I don't have the time to do that or take the risk of having a flat battery at the end of it. Is there another way I can do this?

any help will be appreciated
thanks Joe
6  Using Arduino / General Electronics / voltage regulators on: July 27, 2014, 09:12:46 am
hi there I am using a TA7805F voltage regulators what works but gets very hot jue to high input voltage (28v), could any one recommend anything beater for the job?

thanks Joe
7  Using Arduino / Programming Questions / analong delay? on: July 27, 2014, 09:04:08 am
hi there
I have this bit of code below what woks fine, but what I would like it to do is when the stamen is true for a set period of time before executing the code, say for 4s?

Code:
int FalSafeValue = analogRead(FalSafeInput);
if (FalSafeValue < 100) {
FalSAFE():
}

any help with be appreciated
thanks Joe
8  Using Arduino / General Electronics / Re: attiny84 freezing on: June 13, 2014, 12:37:02 pm
hi there thanks for all your feedback
yes I would agree it is the 3 phase what is playing me up, still having issues so I am all out of ideas?

I have look into the watchdog timer but just seem to reset like every 10s so I don't no if I have dun something wrong?

Code:
//         ***  INPUT'S  ***
const int HeatIn1   =  7;    // input from PC 1
const int HeatIn2   =  8;    // input from PC 2
const int overload1 =  9;    // overload cut out 1
const int overload2 = 10;    // overload cut out 2
const int reverse   =  6;   // reverse swich for heat's

//          *** OUTPUT'S  ***
const int valve     =  11;    // valve in pooler room       // not being used
const int LED       =  5;    // lock out led
const int pump      =  4;    //  pump in pooler room
const int heater1   =  3;    // heater 1 output forwch
const int heater1R  =  2;    // heater 1 output revus
const int heater2   =  1;    // heater 2 output forwch
const int heater2R  =  0;    // heater 2 output revus


#include <avr/wdt.h>

unsigned long resetTime = 0;
#define TIMEOUTPERIOD 10000             // You can make this time as long as you want,
                                       // it's not limited to 8 seconds like the normal
                                       // watchdog
#define doggieTickle() resetTime = millis();  // This macro will reset the timer
void(* resetFunc) (void) = 0; //declare reset function @ address 0

void watchdogSetup()
{
cli();  // disable all interrupts
wdt_reset(); // reset the WDT timer
MCUSR &= ~(1<<WDRF);  // because the data sheet said to
/*
WDTCSR configuration:
WDIE = 1 :Interrupt Enable
WDE = 1  :Reset Enable - I won't be using this on the 2560
WDP3 = 0 :For 1000ms Time-out
WDP2 = 1 :bit pattern is
WDP1 = 1 :0110  change this for a different
WDP0 = 0 :timeout period.
*/
// Enter Watchdog Configuration mode:
WDTCSR = (1<<WDCE) | (1<<WDE);
// Set Watchdog settings: interrupte enable, 0110 for timer
WDTCSR = (1<<WDIE) | (0<<WDP3) | (1<<WDP2) | (1<<WDP1) | (0<<WDP0);
sei();
}


ISR(WDT_vect) // Watchdog timer interrupt.
{
  if(millis() - resetTime > TIMEOUTPERIOD){
  doggieTickle();                                          // take these lines out
  resetFunc();     // This will call location zero and cause a reboot.
  }
}


void setup()
{
  watchdogSetup();
  //        ***  OUTPUT'S  ***
  pinMode(valve   ,    OUTPUT);
  pinMode(LED     ,    OUTPUT);
  pinMode(pump    ,    OUTPUT);
  pinMode(heater1 ,    OUTPUT);
  pinMode(heater1R,    OUTPUT);
  pinMode(heater2 ,    OUTPUT);
  pinMode(heater2R,    OUTPUT);


  //        ***  INPUT'S  ***
  pinMode(HeatIn1,     INPUT);
  pinMode(HeatIn2,     INPUT);
  pinMode(reverse,     INPUT);
  pinMode(overload1,   INPUT);
  pinMode(overload2,   INPUT);

}

int firstTime = true;

enum LoopOneStates {
  Heating, NotHeating, ReverseMode, ReverseModeOn,  ReverseModeOff, WaitingToHeat};

enum LoopTwoStates {
  EitherHot, OpenValve, StartPump, NeitherHot,  CloseValveStopPump};

void loop() {
    if (firstTime){
    firstTime = false;
  }
  if(millis() - resetTime > 2000){
    doggieTickle();  // if you uncomment this line, it will keep resetting the timer.
  }
 
 
  unsigned long currentTime = millis();
 
  //  LoopOne for Heater 1
if (digitalRead(overload1)) {
  static enum LoopOneStates state1 = Heating;
  static unsigned long state1EntryTime = 0;
  switch (state1) {
  case Heating:
    digitalWrite(heater1, HIGH);
    if (!digitalRead(HeatIn1))
      state1 = NotHeating;
    break;

  case NotHeating:
    digitalWrite(heater1, LOW);
    if (digitalRead(reverse)) {
      state1 = ReverseMode;
      state1EntryTime = currentTime;
    }
    if (digitalRead(HeatIn1))
      state1 = Heating;
    break;

  case ReverseMode:
    if (currentTime - state1EntryTime > 30000) {
      digitalWrite(heater1R, HIGH);
      state1 = ReverseModeOn;
      state1EntryTime = currentTime;
    }
    break;

  case ReverseModeOn:
    if (currentTime - state1EntryTime > 10000) {
      digitalWrite(heater1R, LOW);
      state1 = ReverseModeOff;
      state1EntryTime = currentTime;
    }
    break;

  case ReverseModeOff:
    if (currentTime - state1EntryTime > 30000) {
      state1 = WaitingToHeat;
    }
    break;

  case WaitingToHeat:
    if (digitalRead(HeatIn1)) {
      state1 = Heating;
    }
    break;
  }
}
else {
  digitalWrite(heater1,  LOW);
  digitalWrite(heater1R, LOW);
}


  //  LoopOne for Heater 2
  if (digitalRead(overload2)) {
  static enum LoopOneStates state2 = Heating;
  static unsigned long state2EntryTime = 0;
  switch (state2) {
  case Heating:
    digitalWrite(heater2, HIGH);
    if (!digitalRead(HeatIn2))
      state2 = NotHeating;
    break;

  case NotHeating:
    digitalWrite(heater2, LOW);
    if (digitalRead(reverse)) {
      state2 = ReverseMode;
      state2EntryTime = currentTime;
    }
    if (digitalRead(HeatIn2))
      state2 = Heating;
    break;

  case ReverseMode:
    if (currentTime - state2EntryTime > 30000) {
      digitalWrite(heater2R, HIGH);
      state2 = ReverseModeOn;
      state2EntryTime = currentTime;
    }
    break;

  case ReverseModeOn:
    if (currentTime - state2EntryTime > 10000) {
      digitalWrite(heater2R, LOW);
      state2 = ReverseModeOff;
      state2EntryTime = currentTime;
    }
    break;

  case ReverseModeOff:
    if (currentTime - state2EntryTime > 30000) {
      state2 = WaitingToHeat;
    }
    break;

  case WaitingToHeat:
    if (digitalRead(HeatIn2)) {
      state2 = Heating;
    }
    break;

  }
  }
else {
  digitalWrite(heater2,  LOW);
  digitalWrite(heater2R, LOW);
}

  //                                                        **loop two**
  //  LoopOne for Heater 1
  static enum LoopTwoStates state3 = EitherHot;
  static unsigned long state3EntryTime = 0;
  switch (state3) {
  case EitherHot:
    if (digitalRead(HeatIn1) || digitalRead(HeatIn2)) {
      state3 = OpenValve;
      state3EntryTime = currentTime;
    }
    break;

  case OpenValve:
    digitalWrite(valve, HIGH);
    // Fifteen seconds later, starty the pump
    if (currentTime - state3EntryTime > 5000) {
      state3 = StartPump;
      state3EntryTime = currentTime;
    }
    break;

  case StartPump:
    digitalWrite(pump, HIGH);
    state3 = NeitherHot;
    state3EntryTime = currentTime;
    break;

  case NeitherHot:
    // Wait for a full 30 minutes with neither heat indicators on
    if (digitalRead(HeatIn1) || digitalRead(HeatIn2)) {
      // Reset the timer if either heater is on
      state3EntryTime = currentTime;
    }
    if (currentTime - state3EntryTime > 1000UL*60UL*30UL) {
      state3 = CloseValveStopPump;
    }
    break;

  case CloseValveStopPump:
    digitalWrite(valve,       LOW);
    digitalWrite(pump,        LOW);
    state3 = EitherHot;
    break;
  }
  //     Lock out LED
  if (!digitalRead(overload1) || !digitalRead(overload2)) {
     digitalWrite(LED,     HIGH);
  }
     else {
     digitalWrite(LED,     LOW);   
  }
}

9  Using Arduino / Programming Questions / digital read on stat up questions on: June 05, 2014, 03:44:56 pm
Hi there
What I am trying to do is when the arduino starts up I want it to look at a state of a digital pin and choose to do one piece of code or another depending on the state of the input pin being high or low. So in other words in set up to choose to do one loop or another.
But I don't want it to continuously look at the input pin just on start up.

I hope that makes sense, any help would be appreciated.

thanks Joe
10  Using Arduino / General Electronics / Re: regulating 45v to 35v on: April 03, 2014, 02:55:04 pm
 literally 45 to 35V

the 45v is being used for something else so going to pick of that. need to drop it down for a battery charging circuit
11  Using Arduino / General Electronics / Re: attiny84 freezing on: April 03, 2014, 02:32:42 pm
hi there I have test the caps and they seem fine
here is the code


Code:
---------------------------------------------
Set heater1 to match HeatIn1.
 
 If HeatIn1 is low and reverse is high:
 delay 30sec
 write heater1R high
 delay 10sec
 write heater1R low
 delay 30sec
 Wait for HeatIn1 to come on
 
 Set heater2 to match HeatIn2.
 
 If HeatIn2 is low and reverse is high:
 delay 30sec
 write heater2R high
 delay 10sec
 write heater2R low
 delay 30sec
 Wait for HeatIn1 to come on
 
 if HeatIn1 or HeatIn2 are high:

 delay 5sec
 write pump high (Start pump)
 
 if HeatIn1 and HeatIn2 have been low for a full 30 minutes:

 write pump low (Stop pump)
 
 If overload 1 or 2 are high
 write LED high
 */

//         ***  INPUT'S  ***
const int HeatIn1   =  7;    // input from PC 1
const int HeatIn2   =  8;    // input from PC 2
const int overload1 =  9;    // overload cut out 1
const int overload2 = 10;    // overload cut out 2
const int reverse   =  6;   // reverse swich for heat's

//          *** OUTPUT'S  ***
const int valve     =  11;    // valve in pooler room       // not being used
const int LED       =  5;    // lock out led
const int pump      =  4;    //  pump in pooler room
const int heater1   =  3;    // heater 1 output forwch
const int heater1R  =  2;    // heater 1 output revus
const int heater2   =  1;    // heater 2 output forwch
const int heater2R  =  0;    // heater 2 output revus



void setup()
{
  //        ***  OUTPUT'S  ***
  pinMode(valve   ,    OUTPUT);
  pinMode(LED     ,    OUTPUT);
  pinMode(pump    ,    OUTPUT);
  pinMode(heater1 ,    OUTPUT);
  pinMode(heater1R,    OUTPUT);
  pinMode(heater2 ,    OUTPUT);
  pinMode(heater2R,    OUTPUT);


  //        ***  INPUT'S  ***
  pinMode(HeatIn1,     INPUT);
  pinMode(HeatIn2,     INPUT);
  pinMode(reverse,     INPUT);
  pinMode(overload1,   INPUT);
  pinMode(overload2,   INPUT);

}
enum LoopOneStates {
  Heating, NotHeating, ReverseMode, ReverseModeOn,  ReverseModeOff, WaitingToHeat};

enum LoopTwoStates {
  EitherHot, OpenValve, StartPump, NeitherHot,  CloseValveStopPump};

void loop() {
  unsigned long currentTime = millis();
 
  //  LoopOne for Heater 1
if (digitalRead(overload1)) {
  static enum LoopOneStates state1 = Heating;
  static unsigned long state1EntryTime = 0;
  switch (state1) {
  case Heating:
    digitalWrite(heater1, HIGH);
    if (!digitalRead(HeatIn1))
      state1 = NotHeating;
    break;

  case NotHeating:
    digitalWrite(heater1, LOW);
    if (digitalRead(reverse)) {
      state1 = ReverseMode;
      state1EntryTime = currentTime;
    }
    if (digitalRead(HeatIn1))
      state1 = Heating;
    break;

  case ReverseMode:
    if (currentTime - state1EntryTime > 30000) {
      digitalWrite(heater1R, HIGH);
      state1 = ReverseModeOn;
      state1EntryTime = currentTime;
    }
    break;

  case ReverseModeOn:
    if (currentTime - state1EntryTime > 10000) {
      digitalWrite(heater1R, LOW);
      state1 = ReverseModeOff;
      state1EntryTime = currentTime;
    }
    break;

  case ReverseModeOff:
    if (currentTime - state1EntryTime > 30000) {
      state1 = WaitingToHeat;
    }
    break;

  case WaitingToHeat:
    if (digitalRead(HeatIn1)) {
      state1 = Heating;
    }
    break;
  }
}
else {
  digitalWrite(heater1,  LOW);
  digitalWrite(heater1R, LOW);
}


  //  LoopOne for Heater 2
  if (digitalRead(overload2)) {
  static enum LoopOneStates state2 = Heating;
  static unsigned long state2EntryTime = 0;
  switch (state2) {
  case Heating:
    digitalWrite(heater2, HIGH);
    if (!digitalRead(HeatIn2))
      state2 = NotHeating;
    break;

  case NotHeating:
    digitalWrite(heater2, LOW);
    if (digitalRead(reverse)) {
      state2 = ReverseMode;
      state2EntryTime = currentTime;
    }
    if (digitalRead(HeatIn2))
      state2 = Heating;
    break;

  case ReverseMode:
    if (currentTime - state2EntryTime > 30000) {
      digitalWrite(heater2R, HIGH);
      state2 = ReverseModeOn;
      state2EntryTime = currentTime;
    }
    break;

  case ReverseModeOn:
    if (currentTime - state2EntryTime > 10000) {
      digitalWrite(heater2R, LOW);
      state2 = ReverseModeOff;
      state2EntryTime = currentTime;
    }
    break;

  case ReverseModeOff:
    if (currentTime - state2EntryTime > 30000) {
      state2 = WaitingToHeat;
    }
    break;

  case WaitingToHeat:
    if (digitalRead(HeatIn2)) {
      state2 = Heating;
    }
    break;

  }
  }
else {
  digitalWrite(heater2,  LOW);
  digitalWrite(heater2R, LOW);
}

  //                                                        **loop two**
  //  LoopOne for Heater 1
  static enum LoopTwoStates state3 = EitherHot;
  static unsigned long state3EntryTime = 0;
  switch (state3) {
  case EitherHot:
    if (digitalRead(HeatIn1) || digitalRead(HeatIn2)) {
      state3 = OpenValve;
      state3EntryTime = currentTime;
    }
    break;

  case OpenValve:
    digitalWrite(valve, HIGH);
    // Fifteen seconds later, starty the pump
    if (currentTime - state3EntryTime > 5000) {
      state3 = StartPump;
      state3EntryTime = currentTime;
    }
    break;

  case StartPump:
    digitalWrite(pump, HIGH);
    state3 = NeitherHot;
    state3EntryTime = currentTime;
    break;

  case NeitherHot:
    // Wait for a full 30 minutes with neither heat indicators on
    if (digitalRead(HeatIn1) || digitalRead(HeatIn2)) {
      // Reset the timer if either heater is on
      state3EntryTime = currentTime;
    }
    if (currentTime - state3EntryTime > 1000UL*60UL*30UL) {
      state3 = CloseValveStopPump;
    }
    break;

  case CloseValveStopPump:
    digitalWrite(valve,       LOW);
    digitalWrite(pump,        LOW);
    state3 = EitherHot;
    break;
  }
  //     Lock out LED
  if (!digitalRead(overload1) || !digitalRead(overload2)) {
     digitalWrite(LED,     HIGH);
  }
     else {
     digitalWrite(LED,     LOW);   
  }
}
12  Using Arduino / General Electronics / regulating 45v to 35v on: April 03, 2014, 01:58:13 pm
hi there what is the best way I can regulate 45v DC to 35v DC 2A?
or if it is any help I could do it on the AC side? maybe us a x capacitor?

thanks Joe
13  Using Arduino / General Electronics / Re: selecting a temp sensor on: March 19, 2014, 04:02:15 pm
ok thanks

so any one have any experience with  DS18B20 over long lengths?

3 wire or 2 wire?
14  Using Arduino / General Electronics / Re: selecting a temp sensor on: March 19, 2014, 03:00:20 pm
I'm ok with the cable

and don't think the Cat and Kitten would be a good idea for me as we don't wont anything in there just the sensor
15  Using Arduino / General Electronics / selecting a temp sensor on: March 19, 2014, 01:58:31 pm
hi there I'm looking for a temp sensor that I can use with my arduino couple of things I need to bear in mind is the lengths of the cable run could be up to 100m and there is a chance that the sensor could get paled out and the cable being shoed.
I have looked at the DS18B20 I presume I would have to run all 3 cause because of the length? and the volt regulator would not like being shoed?
did look at this:
 http://uk.mouser.com/ProductDetail/Vishay/NTCLP100E3472H/?qs=%2fha2pyFaduhmWE0I5%2f0lUWtfX8rOgM2KbyZFmBhB%252bYgmKCZRDfj59w%3d%3d

but don't no if they are any good?

any suggesting or ideas please say

thanks Joe
Pages: [1] 2 3 ... 20