Show Posts
Pages: 1 [2] 3 4 ... 592
16  Using Arduino / Sensors / Re: Carbon monixide mq7 data sample on: August 26, 2014, 06:07:33 pm
The sensor does not directly read ppm, is sensitive to temperature and humidity, and has to warm up for 24 hours before you can expect stable readings.  Read the sensor data sheet for details.
17  Using Arduino / Networking, Protocols, and Devices / Re: Coordinates on: August 26, 2014, 06:01:45 pm
Yes, if the GPS has a clear view of the sky.
18  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial.println() was not working in Arduino Leonardo on: August 26, 2014, 09:58:19 am
Do you see " i am in setup" if you reset the Arduino?  I suspect you aren't getting Serial Monitor started fast enough to catch the message.  You could put a delay in setup() to allow yourself more time to start Serial Monitor.
19  Using Arduino / Sensors / Re: inputs strange behaviour, on: August 26, 2014, 09:55:15 am
Sounds like Pin A2 and Pin A3 might be shorted together.  Check your wiring.
20  Using Arduino / Project Guidance / Re: 5W or 10W Led Driver for RGB on: August 26, 2014, 09:53:18 am
Do you want to control each of the four colors?  Do you want separate control on each of the ten packages?

You can use an LM317 linear voltage regulator as a current regulator.  You can get then for about $0.25 in quantity 100 via eBay.  You just need a resistor to pick the current.
21  Using Arduino / General Electronics / Re: 240vac Aussie Plug Wiring. on: August 26, 2014, 09:29:10 am
EU death plugs (no doubt from China). 
Imaging you fail to get them aligned correctly and one pin enters whilst the other passes on the outside of the free socket.
You now have a 50:50 chance that the exposed pin is live

It looks like the INTENT is to have the hexagonal recess be deep enough so that the pin won't reach power unless the hexagonal plug fits into the recess.  Of course the intent of the design can be circumvented by lazy implementation.
22  Using Arduino / Installation & Troubleshooting / Re: Marlin Ramps 1.4 Clay Delta upload problem on: August 26, 2014, 07:58:08 am
I think you need to seek out and install the SdFat library.
23  Using Arduino / Programming Questions / Re: Leonardo non-US keyboard output on: August 26, 2014, 07:12:46 am
I have not tried 0-9 (they should work) but when I try to output, for example, < or > it becomes ';'. The output does not line up with the values I have looked up in the ascii table. The keyboard layout I use is Swedish.

How do you type < or > on your Swedish keyboard?  Do you use Shift or AltGr?  On the US English keyboard layout those keys are Shift 0x36 and Shift 0x37.

You can send a key code by adding 136 to it and passing it to Keyboard.press().

Codes from 128 to 135 are the modifier keys.
128 -> Left CTRL
129 -> Left SHIFT
130 -> Left ALT
131 -> Left GUI
132 -> Right CTRL
133 -> Right SHIFT
134 -> Right ALT
135 -> Right GUI

The hard way to send '<' to a system expecting a US layout:
Code:
Keyboard.releaseAll();
Keyboard.press(129);  // Left Shift
Keyboard.press(0x36 + 136);  //  The ',<' key code
Keyboard.releaseAll();
24  Community / Gigs and Collaborations / Re: Arduino autodialler (brute force safe cracker) on: August 25, 2014, 08:24:38 am
Sounds like great fun!   I'd be happy to help.  I have experience with locks, Arduino,  steppers and programming.  I probably have much of the necessary hardware in my possession already.

It would be nice if you happen to be in or near Eastern Massachusetts, USA.  It is much easier to collaborate in person.
25  Using Arduino / Sensors / Re: ADXL345 question. on: August 25, 2014, 08:13:30 am
The accelerometers measure one acceleration vector.  When you are standing still relative to the Earth it is the gravity vector.  When you accelerate from there it is the sum of the gravity vector and your acceleration vector.  To get just your acceleration vector you have to subtract out the gravity vector.  Unfortunately if all you have is an accelerometer you can only measure the gravity vector when you are stationary.

For example, the accelerometer produces the exact same outputs if you are:

A) Upright and stationary on the surface of the Earth.

B) Upside-down and accelerating toward the Earth at 2g.

(At lest until you hit the Earth in case B)

To subtract the gravity vector you need a different way to determine your orientation with respect to the Earth.  Rate gyroscopes  generally drift too much to be of use.  A magnetometer can give you orientation relative to the local magnetic field which should be sufficient for determining the gravity vector:

When stationary (at start-up, for example) measure your magnetic orientation vector and gravity vector.  Calculate the difference vector.  When in motion take the magnetic orientation vector and add the difference vector to get the gravity vector.  Subtract that from your acceleration vector to get your acceleration due to motion.

Of course the acceleration has to be integrated over time so , like a rate gyro, it is likely to drift.
26  Using Arduino / Programming Questions / Re: Missing Ping Library Among Other Things in Code PLEASE HELP on: August 24, 2014, 08:17:22 pm
That means the upload failed.  Time to check the connections, settings (Board and Port).
27  Using Arduino / Programming Questions / Re: Looking for Ideas for multiple conditions / Best way to proceed. on: August 24, 2014, 08:15:13 pm
Looks like you will want to implement a Finite State Machine.  There are lots of websites with instructions and examples.

Here is an example from my own writing:

Note the use of 'enum' (enumeration) variables to track the state.  There are actually two FSM's in this code.  That is why there are separate states.

Note the use of select/case statements to steer to the code that handles the current state.  In each state, check for inputs that  would cause a switch to a different state. If no such events have occurred, just sit in the current state until something happens to move the state to a new state.

Code:
/*
Description of problem:

Set heater1 to match HeatIn1.
 
 If HeatIn1 is low and reverse is high:
 delay 5sec
 write heater1R high
 delay 10sec
 write heater1R low
 delay 10sec
 Wait for HeatIn1 to come on
 
 Set heater2 to match HeatIn2.
 
 If HeatIn2 is low and reverse is high:
 delay 5sec
 write heater2R high
 delay 10sec
 write heater2R low
 delay 10sec
 Wait for HeatIn1 to come on
 
 if HeatIn1 or HeatIn2 are high:
 write valve high (Open valve)
 delay 15sec
 write pump high (Start pump)
 
 if HeatIn1 and HeatIn2 have been low for a full 30 minutes:
 write valve low (Close valve)
 write pump low (Stop pump)
 */

//          *** OUTPUT'S  ***
const int valve     =  2;    // valve in pooler room
const int pump      =  3;    //  pump in pooler room
const int heater1   =  4;    // heater 1 output forward
const int heater1R  =  5;    // heater 1 output reverse
const int heater2   =  6;    // heater 2 output forward
const int heater2R  =  7;    // heater 2 output reverse
const int ledinput  =  8;    // input led from PC

//         ***  INPUT'S  ***
const int HeatIn1   =  9;    // input from PC 1, Active Low
const int HeatIn2   =  10;    // input from PC 2, Active Low
const int reverse   =  11;   // reverse swich for heat's


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

  //        ***  INPUT'S  ***
  pinMode(HeatIn1,     INPUT);
  pinMode(HeatIn2,     INPUT);
  pinMode(reverse,     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
  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 > 5000) {
      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 > 10000) {
      state1 = WaitingToHeat;
    }
    break;

  case WaitingToHeat:
    if (!digitalRead(HeatIn1)) {
      state1 = Heating;
    }
    break;
  }




  //  LoopOne for Heater 2
  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 > 5000) {
      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 > 10000) {
      state2 = WaitingToHeat;
    }
    break;

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

  }

  //                                                        **loop two**


  //  LoopTwo 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 > 15000) {
      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;
  }
}
28  Using Arduino / Programming Questions / Re: Receive VGA TV Signal, Add Caption, Export Signal VGA TV. on: August 24, 2014, 07:37:01 pm
I don't know about VGA but for composite video there is a Video Experimenter Shield:

http://nootropicdesign.com/ve/

29  Using Arduino / Sensors / Re: Adafruit Fingerprint Sensor, having trouble (code) entering a function on: August 24, 2014, 07:33:12 pm
Code:
//Enter time loop to test fingerprint
  for (int time_period = 0; time_period < 80000000; ++time_period)
  {
   uint8_t p = finger.getImage();
       if (p == FINGERPRINT_OK)
       {
         have_image();
         return -1;
       }
   }
   bad_scan();                 [color=red] //when the 5 second FOR LOOP expires, bad_scan is not executed[/color]
   return -1;

So eighty million times through finger.getImage() is supposed to take only 5 seconds?  That's sixteen million times per second!  Since the Arduino can only do sixteen million instruction cycles per second and I expect the getImage() function probably takes tens, hundreds, or even thousands of instruction cycles your '5 second loop' is like to take minutes to days.  You may want to re-write that using millis().
30  Using Arduino / Programming Questions / Re: Missing Ping Library Among Other Things in Code PLEASE HELP on: August 24, 2014, 07:04:06 pm
Looks like the Tone library is not fully compatible with Arduino 1.0.x.

In the library file Tone.cpp change this line:
Code:
#include <wiring.h>
to:
Code:
#include <Arduino.h>
Pages: 1 [2] 3 4 ... 592