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.
|
|
|
|
|
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 // +----+
|
|
|
|
|
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. #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, #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.
|
|
|
|
|
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... 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); }
|
|
|
|
|