Show Posts
Pages: [1] 2 3
1  Using Arduino / Displays / 2.8 TFT Touch Shield: Nothing Displayed on: July 14, 2013, 10:54:05 pm
I am trying to use the Seeed Studio 2.8" TFT Touch Shield v1.0. I downloaded the library provided at: http://www.seeedstudio.com/wiki/File:TFT_Touch_Shield_libraries.zip . The example code wouldn't upload as is, I would get the error: "Tft was not declared in this scope." I've tried all of the example codes, but here's one of them:
Code:
#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
#ifdef SEEEDUINO
  #define YP A2   // must be an analog pin, use "An" notation!
  #define XM A1   // must be an analog pin, use "An" notation!
  #define YM 14   // can be a digital pin, this is A0
  #define XP 17   // can be a digital pin, this is A3
#endif

#ifdef MEGA
  #define YP A2   // must be an analog pin, use "An" notation!
  #define XM A1   // must be an analog pin, use "An" notation!
  #define YM 54   // can be a digital pin, this is A0
  #define XP 57   // can be a digital pin, this is A3
#endif

//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1

#define TS_MINX 140
#define TS_MAXX 900

#define TS_MINY 120
#define TS_MAXY 940


// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

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

void loop(void) {
  // a point object holds x y and z coordinates
  Point p = ts.getPoint();

  if (p.z > ts.pressureThreshhold) {
     Serial.print("Raw X = "); Serial.print(p.x);
     Serial.print("\tRaw Y = "); Serial.print(p.y);
     Serial.print("\tPressure = "); Serial.println(p.z);
  }
 
 
  p.x = map(p.x, TS_MINX, TS_MAXX, 240, 0);
  p.y = map(p.y, TS_MINY, TS_MAXY, 320, 0);
 
  // we have some minimum pressure we consider 'valid'
  // pressure of 0 means no pressing!
  if (p.z > ts.pressureThreshhold) {
     Serial.print("X = "); Serial.print(p.x);
     Serial.print("\tY = "); Serial.print(p.y);
     Serial.print("\tPressure = "); Serial.println(p.z);
  }

  delay(100);
}
To get the example to upload, I had to move the contents within the library folder. The library is called "TFT_Touch_Shield_libraries" and when you open it, two sub folders are shown: "TFT" and "TouchScreen." I kept the contents within the sub folders, but got rid of the separate sub folders themselves. So when I open up "TFT_Touch_Shield_libraries" everything that was within the two sub folders is shown in the window. Now the program uploads without an error.
But here's my problem, I do not see the program being displayed on the TFT shield. Instead the screen only powers up. The bottom of the screen is white, and fades into a tan color at the top of the display:



I was hoping someone might know why the TFT shield is not displaying the animations from any of the example codes. In the example code provided above, you can use the Serial Monitor to print the coordinates of where you are touching the screen as well as the amount of pressure your finger is applying. I am getting those numbers on the Serial Monitor (though the coordinates are always the same, wherever I push), so the program must be working, it's just not being displayed.
In the picture I'm using a Seeeduino Mega 2560, but I've also had the same results on a Seeeduino v3.0 and an Arduino Uno. Thanks.
2  Using Arduino / Networking, Protocols, and Devices / Re: Uploading Sketch On Ethernet Board Through Network on: July 08, 2013, 10:37:39 pm
When I get my new Arduino Ethernet board I will go back through and provide all the information below that you asked for. For some reason my 3.3v and GND have shorted. It happened shortly after I had the PoE and USB connected to the board at the same time. I heard a winding sound when I got the new IP Address and then powered the board with PoE only. I doubt that having the PoE and USB plugged in at the same time caused the short, as I've done that numerous times, but I have no clue why the short exists now (and this isn't the first time it's happened). Thanks for all the help thus far, and I look forward to getting back to this project as soon as possible.
3  Using Arduino / Networking, Protocols, and Devices / Re: Uploading Sketch On Ethernet Board Through Network on: July 08, 2013, 05:19:46 am
I'm pretty embarrassed since I now realize that I wasn't using the correct IP Address for the Ethernet board. Previously I had simply connected the Ethernet cable to my computer, turned off all the WiFi, found the IP Address coming from the Ethernet cable, and used that as my Arduino Ethernet board IP Address (since I would be plugging that same Ethernet cable into it). Then I finally used an example code and found a different IP Address, which I assume gives me the correct Ethernet Board IP Address:
Code:
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.println(Ethernet.localIP());

}

void loop() {

}

Nonetheless I am not getting the program to upload to the Ethernet Board through the network. I will get to the TFTP Put request line, but the connection times out, and ultimately fails. After a number of different attempts, including me pushing the reset button at different times as the program is trying to upload (thank you for the suggestion, pylon), I tried pinging the Ethernet board, and it came back positive that the Ethernet board is detected:



After confirming the detection, I immediately tried to get the program uploading, but ran into the same problems as before.
4  Using Arduino / Installation & Troubleshooting / Arduino Ethernet Board 3.3v & GND Shorted on: July 08, 2013, 04:42:55 am
I have just toasted a third Arduino Ethernet board (NOT shield), but I'm not sure how. The Ground and 3.3v are now connected. I don't have any idea why the first two were shorted. This most recent one occurred after plugging the board into a PoE switch and connecting it to my computer via USB. I doubt those two connections are what caused the short, as I've done that numerous times without any issues. Maybe it's my PoE switch.
I was just wondering if anyone else has been having this issue, or similar ones with the Ethernet Board.
5  Using Arduino / Networking, Protocols, and Devices / Re: Uploading Sketch On Ethernet Board Through Network on: July 03, 2013, 11:31:00 pm
Quote
Are you really sure you have configured your network with a network mask of 255.0.0.0?

You're correct, my Network Mask is 255.255.255.0. The addresses you saw in my previous post were the default addresses coded into the program, not the addresses that I actually used when trying to upload.

Thank you for the help. You were correct about me needing to specify my complete path. I no longer saw the error. However, after including the pathway, I simply got nothing. Just another prompt to enter more instructions to cmd (C:\Users\Arduino>):



I'm not sure if the command was successful or if it did nothing. Regardless, I moved onto the next step and entered the tftp put request to upload the sketch to the board, but got the following message instead (the IP address in the command is supposed to be the one going into the Ethernet board. I got that address by plugging the Ethernet cord into my laptop, turning the Wifi off, and using the cmd window to read my IP Address. Then I took the Ethernet cable and plugged it into the Ethernet board and turned my Wifi back on):



"The -i switch indicates you want to send the file in binary form" (from Freetronics). I reset my Ethernet board to complete the upload, but the file was not transferred to it.

So I decided to restart the process and go through all the steps up to the tftp put request. At that point, I closed the cmd session and started a new one, immediately trying to use the tftp put request. I did this because the instructions on Freetronics, at the point of using the tftp put, say:
Quote

1. Open a console command line window.

2. Perform the upload by typing:

    tftp -i <Arduino IP address> put <filename>.bin

When the first line said to open a console command line window, it sounds to me like it's implying the previous command line window (cmd session) was closed. But doing that simply gave me a "Connect request failed" line:



I'm not sure if that error is due to the fact that I did not go through the previous steps in the same session, and simply began the session with a tftp put command, or maybe there is a problem trying to connect to the Ethernet board (wrong IP address, etc).
6  Using Arduino / Networking, Protocols, and Devices / Uploading Sketch On Ethernet Board Through Network on: July 03, 2013, 03:59:36 am
Hello, I am trying to figure out how to upload a sketch to my Arduino Ethernet (w/ POE) through an ethernet cable based on steps from Freetronics (url: http://www.freetronics.com/pages/how-to-upload-a-sketch-to-your-arduino-via-a-network#.UdOeAm3hdy8).
My USBTinyISP v3.0 was able to burn the bootloader no problem using the Arduino-TFTPBoot from Github (url: https://github.com/freetronics/arduino-tftpboot/downloads).
The "WriteNetworkSettings" example from that library needs to configure the network. On my Windows 7, I went to the cmd Prompt to get my network addresses:
What the Library Asks For                    What I Equate it to In cmd
Gateway IP Address                            Default Gateway
Arduino Device IP Address                   IPv4 Address
Subnet Mask                                      Subnet Mask

Then I uploaded the WriteNetworkSettings example code, and reburned the bootloader (part of the steps from Freetronics)
Code:
#include <EEPROM.h>

uint8_t NetworkSettings[] = {
  0x55, 0xAA, // Signature
  0xFF, // Image Status (bad)
 
  // EEPROM block starts here
  10,1,1,1,                       // Gateway IP address
  255,0,0,0,                      // Subnet mask
  0x12,0x34,0x45,0x78,0x9A,0xBC,  // MAC address
  10,1,1,20,                      // Arduino device IP address
};

void setup() {
  for (int address = 0; address < sizeof(NetworkSettings)/sizeof(uint8_t); address++) {
    EEPROM.write(address, NetworkSettings[address]);
  }
  pinMode(9, OUTPUT);     
}
void loop() {
  digitalWrite(9, HIGH);
  delay(100);
  digitalWrite(9, LOW);
  delay(100);
}

To check that my computer is connecting to the Ethernet board, I pinged the Ethernet board (I believe I'm pinging the correct device. I ping the IP Address my computer uses when I turn off the WiFi and use the Ethernet cord; the same one which I later plug into the Ethernet board).
I then returned to 'cmd' and typed in the path to my avr-object and got a list of options:


...and so forth. Which I believe is good since it's not an error.


From there I put in the path to my test sketch, but I got the following error:


I'm not sure what that error means, but it's holding me up from moving forward. Thanks
7  Using Arduino / Networking, Protocols, and Devices / Re: Serial Monitor Print From Outside Server on: June 21, 2013, 08:14:44 pm
Thank you for all your help Zoomkat and SurferTim. My device is quite stable now.
8  Using Arduino / Networking, Protocols, and Devices / Re: Serial Monitor Print From Outside Server on: June 14, 2013, 11:51:18 pm
When I use the IP address example code provided by Zoomkat on it's own, it works, but then when I incorporate it into the code my device hangs up.
But when I declare my IP address using:  IPAddress server(XX,XX,XX,XX);      and add the GET functions the program works properly the first few times that I press my button. But eventually it hangs up, and always at the point when the program reads:  if (client.connect(server, 80))    .    After that, resetting the board and/or reuploading the program wont even allow the program to get through one loop cycle before crashing. If I unplug the device and restart the Arduino IDE, the program usually works for a little bit before hanging up.

Here's the relevant code (very similar to the previous codes I've posted):
Code:
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#include <Time.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x3B, 0x8E }; //physical mac address

IPAddress server(XX,XX,XX,XX); // Guard Alarm IP

EthernetClient client;

void setup()
{
    if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
 
  Serial.begin(9600); 
  Serial.println("Serial begin:");
}

void loop()
{
   if(confirmed == true)    // Confirms that the button was pushed
     {
   
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    sendGET(); // call sendGET function to confirm button was pushed
     }
}

void sendGET() //client function to send/receive GET request data.
{

 if (client.connect(server, 80)) {
    Serial.println("connected");
   
    delay(500);
   
    client.println("GET /guardmon_report.php"); // The site I'm trying to connect to

    delay(500);
   
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

Thanks again for everyone's help so far.
9  Using Arduino / Networking, Protocols, and Devices / Re: Serial Monitor Print From Outside Server on: June 14, 2013, 05:42:54 am
I incorporated Zoomkat's example into the code I'm using and everytime I push the button on my device I am able to successfully connect to the website. Thank you for that
But when I substitute the: char serverName[] = "web.comporium.net";    which is used in the example code for my: IPAddress server(XX,XX,XX,XX);      code, and make the necessary changes in my GET line to pull the information I want from the website, it almost always hangs up.
I say "almost always" hangs up because sometimes on my first attempt after uploading the program it will run a successful GET, but after that I keep getting hangups that activate my Watchdog Timer. Here's the revised section of code that deals with the internet aspect:
Code:
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#include <Time.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //mac address

//char serverName[] = "web.comporium.net"; // zoomkat's test web page server

  IPAddress server(XX,XX,XX,XX); // IP to the GET site

  EthernetClient client;

void setup()
{
    if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
 
  Serial.begin(9600); 
  Serial.println("Serial begin:");

void loop(){
if(confirmed == true)    // Push button is pressed
  {
   
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    sendGET(); // call sendGET
   }
}


void sendGET() //client function to send/receive GET request data.
{
//  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
 if (client.connect(server, 80)) {
    Serial.println("connected");
   
//    delay(500);     I tried adding a delay
   
    client.println("GET /guardmon_report.php"); // The site I'm trying to connect to
//    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text from Zoomkat example
//    client.println("Host: web.comporium.net");

    delay(500);    // I tried adding another delay
   
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client
}

I know it's not a network problem, but is there something about using an IP Address instead of a DNS above the void setup() that would cause my program to hang up?

10  Using Arduino / Networking, Protocols, and Devices / Re: Serial Monitor Print From Outside Server on: June 13, 2013, 02:33:18 am
Wow, how embarrassing. Your program worked perfectly when I actually did what I was supposed to do.
11  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet lockups/freezes/non responsive on: June 12, 2013, 05:57:15 am
One reason your Ethernet board might be locking up is because of the sheer size of your code. I am experiencing the same problem with my Ethernet board and was informed that the problem might be a lack of free RAM memory. User PaulS suggested this website: http://playground.arduino.cc/Code/AvailableMemory which has a library on it that you can use to determine how much RAM you have left. I am going to go through my code and condense it in hopes that this will solve my hang up problem.
12  Using Arduino / Networking, Protocols, and Devices / Re: Serial Monitor Print From Outside Server on: June 12, 2013, 05:50:25 am
Quote
Is this the code that causes the problem? If not, post that code.

Through a series of commenting line after line I have determined that the line that causes the hangups is :
 if (client.connect(server, 80)) { ...

After trying out a RAM memory library, it showed that I had approximately 700 bytes of RAM left. I will start going back through the rest of the code and trying to clean it up so I use less RAM.

Zoomkat, for some reason my Ethernet board will not make a connection to the web server using your code. I get two lines showing up on my Serial monitor:

Better client test 9/22/12
Send an e in serial monitor to test

After those, nothing happens. But I do get a connection on other servers when I use some other programs.

Thank you both for your help so far.
13  Using Arduino / Networking, Protocols, and Devices / Serial Monitor Print From Outside Server on: June 10, 2013, 05:44:41 am
Hello, I am putting together a device, and one aspect of it needs to be able to connect to an outside web server and display the information from the site when the push button on the device is pressed. However, I am getting several different errors when I try to make it work. Sometimes the device hangs up until my watchdog timer resets the system. Other times the Serial monitor will say:
Pressed
connecting...
connection failed


While other times the Serial monitor displays:
Pressed
connecting...
connected
passed the GET command

at which point the program has entered the block of code where I use a GET statement to retrieve the information from the server, but the program does not display it for me.

I am using an Arduino Ethernet board (not a shield). I know that none of the libraries are in conflict here, as I've uploaded examples with all of them added and had no problems. Here is the code below dealing with only the internet aspects of the program. Thanks for any help.

Code:
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#include <Time.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server(XX,XX,XX,XX);  // IP Address of site I wish to connect to

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(XXX,XXX,X,XXX);     //my computer's IP Address

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

boolean confirmed = false;

void setup()
{
  Serial.begin(9600); 
  Serial.println("Serial begin:");
 
   confirmed = false;
}

void loop()
{
 if(confirmed == true)    // Indicates button was pushed. Device should GET information from the server
  {
   
     // start the Ethernet connection:
    if (Ethernet.begin(mac) == 0) {

    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }

  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1"); // Just the site from the WebClient library example code

    client.println();
    Serial.println("passed the GET command");

    // if there are incoming bytes available
    // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    }
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}
14  Using Arduino / Audio / VS1053 MP3 Shield Not Reading SD Card on: May 24, 2013, 12:26:39 am
Hello, I have my geeetech VS1053 MP3 Shield attached to my Uno with a Sandisk MicroSD card storing a few songs. I have tried several examples and different libraries, but none are playing my MP3s.

The first one comes from: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/MP3_Player_Example.pde .
In the comments it's told that in order "To compile, you MUST change Sd2PinMap.h of the SDfatlib!
 The default SS_PIN = 10;. You must change this line under the ATmega328/Arduino area of code to
 uint8_t const SS_PIN = 9;. This will cause the sdfatlib to use pin 9 as the 'chip select' for the
 microSD card on pin 9 of the Arduino so that the layout of the shield works."

I could not find the Sd2PinMap.h in my SDfatlib, but I downloaded the Sd2PinMap.h separately and added it to the SDfatlib, then proceeded with the above mentioned change. The program uploads without a problem, but the Serial monitor tells me that the program "Failed to open track001.mp3" and so on through track100.mp3. I renamed my MP3s "track001.mp3" and so forth, so I know it's not a problem with the name of the file.

From Bill Porter's website: http://www.billporter.info/2012/01/28/sparkfun-mp3-shield-arduino-library/ I tried his SFEMP3Shield library and examples The serial monitor immediately gives me an "Error code: 6 when trying to start MP3 player Warning: patch file not found, skipping." And when I try to play a track I get an "Error code: 2 when trying to play track", which, according to his list of Error Codes means "File Not Found." The program has a feature that allows one to make sure that the SD card can be read when you input "d" into the serial monitor, and the serial monitor displays all of my music and even the pictures saved on the SD.

Not really sure at this point why the music from my SD card is not being played. Thanks ahead of time for any help.
15  Using Arduino / Displays / Re: 12864 Graphics LCD Wiring on: May 22, 2013, 04:48:13 am
Thank you both for your help. I used the u8glib and my screen is finally working. I look forward to trying out your library as well dc42. Again, thank you both.
Pages: [1] 2 3