Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Project Guidance / RFID Computer Lock on: April 22, 2013, 11:11:44 am
Alright, I've made an RFID device with a built in database on an SD card. Here's my issue. I'd like to use this as a computer unlocking device. I'd like to connect it to my computer via USB and be able to wake the computer from sleep, delay an amount of time, and put in my password to unlock the computer. I've got a mac, so if it wakes the computer up, it would be easy to put in the password.  Problem is, if I scan the RFID tag, and the computer isn't asleep, I don't want anything to happen.  Any thoughts?
2  Using Arduino / Programming Questions / Re: WiFi Shield - WiFi.begin returns "4"??? on: December 07, 2012, 03:28:27 am
It would help to see all of your code. The number you're getting may be because of the network you're trying to connect to. If you're trying to connect to a WEP network, using "pass" is not going to work, as you have to provide the hex key to gain access. Again, seeing all of your code would be very helpful.
3  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 09:13:56 pm
I tried 1 and it gave me odd numbers again. A1 does the same thing.
4  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 08:22:39 pm
I've found the pin diagram in the core I am using. Could someone tell me what I should put in the parenthesis for analogRead() for analog input 1?

//
//                                +-\/-+
//  Ain0       (D  5)  PB5  1|    |8   VCC
//  Ain3       (D  3)  PB3  2|    |7   PB2  (D  2)  INT0  Ain1
//  Ain2       (D  4)  PB4  3|    |6   PB1  (D  1)        pwm1
//                        GND  4|    |5   PB0  (D  0)        pwm0
//                           +----+
5  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 08:15:15 pm
Any ideas?
6  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 08:00:17 pm
I am using analog pin 1, but it is pin 2 in the pinout chart. I am using a core I found that is from here. http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0022-0008.zip&can=2&q=

This added support for the Tone function, which I need once I can get the analogread to work properly.
7  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 07:50:41 pm
In the revised test code I'm using the 2. I've also used 3 and 4 with the same results.
8  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 07:46:23 pm
I'm using Pin 2, (Analog input 1).

What do you mean by core?
9  Using Arduino / Programming Questions / Re: analogRead problem on: November 25, 2012, 07:33:51 pm
A small votage under 5 volts, specifically 3.9v. I just wrote this code really quickly to just test the voltage and it's still giving me erratic numbers.

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0,1);

int val = 0;

void setup() {
 
  mySerial.begin(9600);
 
}

void loop() {
 
  val = analogRead(2);
 
  mySerial.println(val);
 
  delay(3000);
 
}

Here's the serial output.
483
464
451
440
438
436
438
443
457
465
464
 It should be around 700, not around 400.
10  Using Arduino / Programming Questions / analogRead problem on: November 25, 2012, 07:26:36 pm
I'm running this code,
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0,1);

int val = 0;

void setup() {
 
  mySerial.begin(9600);
 
}

void loop() {
 
  val = analogRead(2);
 
  mySerial.println(val);
 
  delay(3000);
 
}

on an ATTiny85 and I'm measuring the voltage through one of the analog inputs. I am using a bench DC power supply and it's staying at a constant voltage, but the serial print that it does when it reads a voltage is erratic, and inconsistent. I have tried averaging, as seen in the code, but it doesn't seem to help. Please take a look!


Here's the serial output.
736
724
860
712
751
856
696
790
838
687
822
816
673
850
797
686
868
765
706
870
736
728
861
708
756
851
691
791
833
682
824
815
674
852
790
686
869
756
708
867
725
735
860
704
762

Edit: Changed code to test code. Same situation.
11  Using Arduino / Programming Questions / Re: Problem with reading voltages and possible code faults. on: November 16, 2012, 01:34:42 am
I do, I'm going to set it up on a breadboard and use an FTDI chip to get serial output. Thanks.
12  Using Arduino / Programming Questions / Re: Problem with reading voltages and possible code faults. on: November 16, 2012, 01:26:59 am
Unfortunately, I am using an ATTiny85 which is not, (as it is set up) capable of serial output. Gonna have to find a different way of doing this. Or buy some more parts and an FTDI chip and breadboard it. That was my last resort if I couldn't get it figured out here.
13  Using Arduino / Programming Questions / Re: Problem with reading voltages and possible code faults. on: November 16, 2012, 12:50:26 am
I know this. Right now, for troubleshooting purposes I am using a bench DC power supply that is set to 12.6v (fully charged 3 cell Li-Po). It runs this, then selects the buzz and cut voltages to be used. Could this be the problem? If setup() sets a variable like "buzz" to something like 575, can loop read "buzz" as 575 or is it still 0?
14  Using Arduino / Programming Questions / Re: Problem with reading voltages and possible code faults. on: November 16, 2012, 12:17:27 am
Thanks for the reply. The reason multiple readings are taken and then averaged is because the device that uses the voltage from the battery causes the battery voltage to dip sometimes.  I average three voltages so if there is a dip, it won't prematurely buzz or cut the voltage.

My calculations are as follows. I figured out what a fully charged cell for a Li-Po battery would be. (4.2v) and a dead cell. (3v). From there I can calculate what I need each number to be using a small table I made. I measured the voltages I got going through the voltage divider and recorded them to a table. Using that table I was able to divide the number of millivolts I wanted by 4.9mv (taken from AnalogRead info page) and that would give me the number of units I needed to use.

Any ideas?
15  Using Arduino / Programming Questions / Problem with reading voltages and possible code faults. on: November 15, 2012, 09:38:40 pm
Hello all,

I am making a device to read the voltage of a battery, detect whether it's a 2 cell or 3 cell Li-po, and do an action depending on the voltages.  The device reads the voltage, for a 2 cell or 3 cell and selects the "buzz" and "cutoff" voltages. The buzz and cutoff voltages are for a piezoelectric buzzer, and a MOSFET. The MOSFET controls whether the voltage is passed through to the output terminals for power to an external device. The buzzer buzzes if the battery gets too low and needs to be changed. The point of the MOSFET is to cut the power to the external device if the battery gets too low, so that it doesn't discharge more and destroy the battery. Now, with all of this said, I have written up this code, and it seems to be flawless. However, when I hook it up to my bench DC power supply set to 12.6v (Fully charged 3 cell Li-Po) it waits to take the voltage like it should, takes the voltage, then buzzes and cuts the voltage immediately. I have calculated the values I have used in the code from the information given on the Arduino page about AnalogRead. The voltage from the battery goes through a voltage divider and steps it down so the Arduino can read it. May I also point out that this code is being put onto an ATTiny85, which is why the pins may be different. If anyone has any insight on what the problem might be that would be much appreciated. Here is the code...

Code:
int val = 0, cut = 0, buzz = 0, val1 = 0, val2 = 0, val3 = 0, finalval = 0, addfloat = 0;
boolean buzzed = false, cutoff = false;

void setup() {

  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  delay(3000);

  val = analogRead(2);
  delay(500);
  val1 = analogRead(2);
 
  addfloat = val + val1;
 
  finalval = addfloat / 2;

  if (finalval >= 700) {
    buzz = 591;
    cut = 570;
  }
  else if ( finalval >= 450) {
    buzz = 398;
    cut = 367;
  }
}

void loop() {

  val = analogRead(2);
  delay(300);
  val1 = analogRead(2);
  delay(300);
  val2 = analogRead(2);
  delay(300);
  val3 = analogRead(2);
 
  addfloat = val + val1 + val2 + val3;

  finalval = addfloat / 4;
 
  if (!cutoff) {

    if (finalval <= buzz && !buzzed) {

      tone(1, 4500);
      delay(250);
      noTone(1);
      delay(250);
      tone(1, 4500);
      delay(250);
      noTone(1);
      delay(250);
      tone(1, 4500);
      delay(1000);
      noTone(1);
      buzzed = true;
    }

    if (finalval <= cut && !cutoff) {
      digitalWrite(0, LOW);
      cutoff = true;
    }
    if (!cutoff) {
      digitalWrite(0, HIGH);
    }
  }
  delay(1000);
}
Pages: [1] 2 3 4