Show Posts
|
|
Pages: [1] 2
|
|
1
|
Products / Arduino Esplora / Re: Stopping the mouse program example?
|
on: December 26, 2012, 03:32:18 pm
|
From http://arduino.cc/en/Tutorial/EsploraJoystickMouseThis sketch will take over the mouse movement of your computer. If you lose control of your cursor do the following : - unplug the Esplora - open the EsploraBlink sketch in the Arduino software - hold the Esplora's reset button down while plugging it back in to your computer - while continuing to hold the reset button, click "Upload" in the Arduino software - when you see the message "Done compiling" in the Arduino IDE, release the reset button
|
|
|
|
|
2
|
Using Arduino / Project Guidance / Re: Using a capacitive sensor to detect multiple people
|
on: January 10, 2012, 10:31:08 am
|
|
There's no question there will be environmental issues (this will be outdoors), but that's sort of ok. Some variance from person to person, group to group is acceptable, as long as it's possible to know when no one is there.
Certainly measuring resistance across people will yield more reliable results, but it looks like there is only one point of contact available.
|
|
|
|
|
3
|
Using Arduino / Project Guidance / Using a capacitive sensor to detect multiple people
|
on: January 09, 2012, 10:35:10 pm
|
|
Hi.
I've been playing around with the CapSense library. It works great when I'm touching it. touch touch touch, all day long. I'm curious if there is a way to sense of there is another person or two touching the person connected to the sensor.
With a 10M ohm resistor and unshielded wire, when I hold someones hand while touching the wire I see a small but not particularly significant change in the values. How could I make this more pronounced? I know that changing the resistor value will give me different sensitivities, but from what I've seen it's a linear change, and the different remains (scale-wise) rather small.
Is there a better circuit/sensing solution I could be looking into?
|
|
|
|
|
5
|
Using Arduino / Programming Questions / SD card read speed increases over time
|
on: November 05, 2011, 02:51:18 pm
|
I'm reading a large number of files off a SD card. They are named in ascending order from 0.txt to 3599.txt. When the filename is between 0.txt - 99.txt, the program runs at a reasonable clip, processing a couple files a second. Once it gets to 100-999, it slows significantly, to maybe one a second. When the file name reaches 1000 or greater, the read slows to a crawl, updating maybe every 2 seconds. When the whole thing loops back to 0.txt, it picks up steam again. I figure this has something to do with the clunky code I'm writing for iterating through the files. The relevant bits are below, any assistance would be great. (I don't know if it matters, but I'm using Arduino 1.0 RC2) #include <SD.h>
const int chipSelect = 4; File dataFile; int whatfile=0;
String inString=""; String extension=".txt";
void setup() { Serial.begin(9600); pinMode(10, OUTPUT); SD.begin(chipSelect); }
void loop() {
String thefile; if(whatfile==3600){ whatfile=0; }
thefile+=whatfile; thefile+=extension;
char fileName[12]; thefile.toCharArray(fileName, (thefile.length()+1)); dataFile = SD.open(fileName); if (dataFile) { //process file and close it dataFile.close(); } Serial.println(fileName); whatfile++; }
|
|
|
|
|
6
|
Using Arduino / Installation & Troubleshooting / Arduino Uno SMD not recognized by Windows 7
|
on: August 23, 2011, 02:27:59 pm
|
|
I have an Arduino UNO SMD that showed up as a COM port, as expected.
Last night, after a reboot, it stopped being recognized as a viable COM port and appeared as an unknown device.
This happens with two different boards, with numerous restarts in between, different USB ports, and using external power. Uninstalling and reinstalling the driver does nothing to help.
Any ideas why this may be happening, or advice on how to make it work properly?
Thanks
|
|
|
|
|
9
|
Forum 2005-2010 (read only) / Interfacing / Re: TCP/IP with SM5100B GSM/GPRS module
|
on: October 29, 2010, 05:01:52 pm
|
Bump, plus more refined code : Now I'm seeing this : Starting SM5100B Communication... GPRS Network Not Available GPRS AT Ready Setting up PDP Context OK Sending null password Activating PDP Context Configuring TCP connection to TCP Server OK Checking Connection Status +SOCKSTATUS: 1,0,0000,0,0,0 I *should* be seeing an "OK" after the "Activating PDP Context" Even when entering manually I'm getting no love. Any ideas why? #include <NewSoftSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module. #include <string.h>
#define BUFFSIZ 90
char at_buffer[BUFFSIZ]; char buffidx; int firstTimeInLoop = 1; int GPRS_registered; int GPRS_AT_ready; char incoming_char=0; //Will hold the incoming character from the Serial Port. char buffer[60]; String myString="1";
NewSoftSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
// Do system wide initialization here in this function void setup() { Serial.begin(9600); cell.begin(9600); //Let's get started!
Serial.println("Starting SM5100B Communication..."); delay(5000); /* Currently GPRS is not registered and AT is not ready */ GPRS_registered = 0; GPRS_AT_ready = 0;
}
/* Reads AT String from the SM5100B GSM/GPRS Module */
void loop() {
/* If called for the first time, loop until GPRS and AT is ready */
if(firstTimeInLoop) { FunctionToCheckWeAreConnectedToNetwork(); }
delay(1500);
Serial.println("Setting up PDP Context"); cell.println("AT+CGDCONT=1,\"IP\",\"epc.tmobile.com\""); delay(1000); while(cell.available()){ incoming_char=cell.read(); Serial.print(incoming_char); }
Serial.println("Sending null password"); // cell.println("AT+CGPCO=0,\"none\",\"none\", 1"); delay(1000); while(cell.available()){ incoming_char=cell.read(); Serial.print(incoming_char); }
Serial.println("Activating PDP Context"); cell.println("AT+CGACT=1,1"); delay(1000); while(cell.available()){ incoming_char=cell.read(); Serial.print(incoming_char); }
Serial.println("Configuring TCP connection to TCP Server"); cell.println("AT+SDATACONF=1,\"TCP\",\"88.87.58.126\",5000"); delay(1000); while(cell.available()){ incoming_char=cell.read(); Serial.print(incoming_char); }
}
Serial.println("Checking Connection Status\n"); cell.println("AT+SDATASTATUS=1"); delay(1000); while(cell.available()){ incoming_char=cell.read(); Serial.print(incoming_char); }
}
|
|
|
|
|
10
|
Forum 2005-2010 (read only) / Interfacing / TCP/IP with SM5100B GSM/GPRS module
|
on: October 28, 2010, 02:42:53 pm
|
More fun with this board http://www.sparkfun.com/commerce/product_info.php?products_id=9607. Following these app notes : http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCPIP%20App%20Note.pdf, I am trying to connect to a server with this module. But I'm not having much (any!) luck with it. What I have below (apologies for the length, but it is the relevant parts) should open a socket and connect to google.com. However, it never gets to the connecting a socket part. What I see in the serial monitor is this : "Booting up... GPRS Registered GPRS AT Ready AT+CGATT=? AT+CGDCONT=1,'IP','telenor' AT+CGPCO=0,'dj','dj',1 AT+CGACT=1,1 at+sdataconf=1,"TCP","google.com",80 at+sdatastart=1,1 at+sdatastatus=1 Socket Status to Follow" So it seems to not be 1) making the connection 2) not printing out what it receives Any ideas? #include <NewSoftSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module. #include <string.h> //Used for string manipulations
int sockConnect = 0; //checks to see if the sockets is connected int dataIn = 0; //is there data in the buffer? char incoming_char=0; //Will hold the incoming character from the Serial Port. String statusRegistered="\r\n+SIND: 4";
NewSoftSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void gprsinit(){ cell.print("AT+CGATT=?"); Serial.println("AT+CGATT=?"); cell.print(0x0D); waitForOK(); cell.print("AT+CGDCONT=1,'IP','telenor'"); Serial.println("AT+CGDCONT=1,'IP','telenor'"); cell.print(0x0D); waitForOK(); cell.print("AT+CGPCO=0,'dj','dj',1"); Serial.println("AT+CGPCO=0,'dj','dj',1"); cell.print(0x0D); waitForOK(); cell.print("AT+CGACT=1,1"); Serial.println("AT+CGACT=1,1"); cell.print(0x0D); waitForOK(); }
void datasendandreceive(){ cell.print("at+sdataconf=1,\"TCP\",\"www.google.com\",80"); Serial.println("at+sdataconf=1,\"TCP\",\"www.google.com\",80"); cell.print(0x0D); waitForOK(); cell.print("at+sdatastart=1,1"); Serial.println("at+sdatastart=1,1"); cell.print(0x0D); waitForOK(); cell.print("at+sdatastatus=1"); Serial.println("at+sdatastatus=1"); cell.print(0x0D); Serial.println("Socket Status to Follow"); waitForSockStatus(); cell.print("at+sdatasend=1,10"); // where 10 is how many bytes to send cell.print("1"); cell.print(0x1A); waitForOK(); //check to see if data has been received +STCPD:1 hasDataBeenReceived(); if(dataIn==1){ cell.print("AT+SDATATREAD=1"); // read the data cell.print(0x0D); getMessage(); } else{ //start over }
cell.print("AT+SDATASTART=1,0"); // close the connection waitForOK(); }
//reads through the buffer until it reaches the letter 'K' void waitForOK(){ while(cell.available()) { incoming_char=cell.read(); //Get the character from the cellular serial port. Serial.print(incoming_char); delay(2); } Serial.println(); }
//waits to connect to the socket void waitForSockStatus(){ //Patterns to look for String prefix="+SOCKSTATUS: 1,"; String input=""; char value;
while(cell.available()<1){ //wait for a cycle }
while(cell.available()>0){ incoming_char=cell.read(); //read the buffer Serial.println(incoming_char); input+=incoming_char; //add it to the string if(input.substring(0)==prefix) //if it matches our expected string { break; } }
incoming_char=cell.read(); //Serial.println(incoming_char); if(incoming_char=='1'){ Serial.println("Socket connected"); sockConnect=1; } else{ Serial.println("Socket NOT connected"); sockConnect=0; } //clear the buffer while(cell.available()>0){ incoming_char=cell.read(); } }
void getMessage(){ //Patterns String prefix="+SDATA: 1, "; String input=""; String ourM="\r\n"; boolean y=false; boolean m=false;
//print the message cell.print('AT+SDATATREAD=1'); cell.print(0x0D);
while(cell.available()<1){ //wait for a cycle }
//First, find the prefix while(cell.available()>0){ incoming_char=cell.read(); //read the buffer input+=incoming_char; //add it to the string if(input.substring(0)==prefix) //if it matches our expected string { //Data is present y=true; break; } }
//read message until we reach the comma, which is the start of the new message while(cell.available()&&y==true) { if(incoming_char!=','){ incoming_char=cell.read(); } else{ break; } }
//get our message while(cell.available()>0){ incoming_char = cell.read(); //read the buffer messageToSign.concat(incoming_char); //add it to the string if(messageToSign.endsWith(ourM)) { break; } } }
void hasDataBeenReceived(){ //Pattern String hopeItsThere= "+STCPD:1"; String input="";
while(cell.available()<1){ //wait for a cycle }
while(cell.available()>0){ incoming_char=cell.read(); //read the buffer input+=incoming_char; //add it to the string if(input.substring(0)==hopeItsThere) //if it matches our expected string { //Data is present dataIn=1; } else{ //no data dataIn=0; } } }
void setup() { //Initialize serial ports for communication. Serial.begin(9600); cell.begin(9600); delay(1000); //Let's get started! Serial.println("Booting up..."); }
void loop() { //typically there is code here that make sure we have connected to the network gprsinit(); datasendandreceive(); }
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Interfacing / Re: send SMS with Arduino
|
on: October 24, 2010, 08:57:13 pm
|
Here's the code I used with a Sparkfun GSM/GPRS modem shield and a Duemilanove. Hopefully it will be helpful : #include <NewSoftSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module.
char r=13; //return character NewSoftSerial cell(4,3); //Create a 'fake' serial port. Pin 4 is the Rx pin, pin 3 is the Tx pin. String cellContent=""; //string we're sending String ctlZ="\x1A"; //the code for Ctrl-Z
String content="Here is my SMS messaage"; //The text I'm sending
void setup() {
// start the serial library: Serial.begin(9600); cell.begin(9600);
}
void loop() {
//add our message to the CellContent string cellContent+=content; //add the Crtl-Z hex character cellContent+=ctlZ; //put the modem into text mode textMode(); //wait for a moment delay(50); //send message sendMsg();
cellContent=""; delay(15000);
}
void textMode() { //init text mode cell.print("AT+CMGF=1"); cell.print(r); }
void sendMsg(){ //This number needs to be replaced with the number you are sending to cell.print("AT+CMGS=\"3474226409\""); cell.print(r); cell.print(cellContent); cell.print(r); }
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Interfacing / Re: Ethernet shield + SM5100B GSM/GPRS Module
|
on: October 17, 2010, 01:23:31 pm
|
Found a solution that did not require more equipment  I bent up pin2 on the cell shield and made a jumper to pin 4. Changed the NewSoftSerial code to this : NewSoftSerial cell(4,3); and I placed the cell shield on an extra set of make/female headers so it rests on top of the ethernet shield (which is typically too tall for other shields to sit on top). The while loop doesn't seem to work with my setup, so for the time being, I'm reverting back to the goto. Thanks for your help.
|
|
|
|
|
14
|
Forum 2005-2010 (read only) / Interfacing / Re: Ethernet shield + SM5100B GSM/GPRS Module
|
on: October 17, 2010, 11:38:17 am
|
|
Ok, missed that.
Though using the hardware serial on the GSM module would bypass this problem, yes?
If so, I suppose the question would be how to monitor while debugging (empty shield as passthrough?)
[edit]Or, would it be possible to jump the GSM board pin 2 to somewhere else and change the NewSoftSerial to read that?[/edit]
|
|
|
|
|
15
|
Forum 2005-2010 (read only) / Interfacing / Re: Ethernet shield + SM5100B GSM/GPRS Module
|
on: October 17, 2010, 10:22:30 am
|
The GSM shield only uses pins 0 and 1 or 2 and 3. Which pins does the ethernet shield use? Which shield is it? The Ethernet shield is a recent vintage 'official' one, so pins 11, 12, and 13. (This is using a Duemilanove). If I comment out the NewSoftSerial parts for communicating with the modem and leave the boards stacked, the Ethernet stil can't communicate. Thanks for the tip on losing the goto, I hoped there would be a smarter way to do that.
|
|
|
|
|