ArduinoGeneral

Did I fry my Xboard Relay?

userHead geraldl 2013-11-19 07:33:41 3300 Views2 Replies
I have one Xboard Relay that does not get recognized in IDE nor Windows. The bootloader com port(com15) and then disappears. Then I would get the Leonardo com (com16) that stays. I understand that the bootloader appears as a separate com port and then the Leonardo shows up afterwards. NOw the bootloader com appears and then disappears but no leonardo. Is there anything I could do? Is this still hope since I temporarily see the bootloader com port? Luckily I had a spare xboard, but I would really like to save this one. Thanks for any help.

G.
2013-11-20 08:07:30 [quote="Jose"]
Hi Geraldl!

Send the last sketch you uploaded on the xboard?
And a picture of your hardware, with modules attached if any, and the power supply used.

Cheers
[/quote]

Hi Jose, this was the last thing to be uploaded. I am only using a usb cable for power. No modules installed,  once they get going I read a voltage on the analog in channel.  You may notice, I had to replace a diode previously, but it worked great after that. It was basically after the upload of the sketch the problem occurred. I am not sure if it completed, even though the IDE did say so. After the uP reboot it hung. I do have other (7) Xboards and they work with the sketch. It's only because I only have this one left to play with since the others are in use and I would like to keep this as my spare. I am hoping to maybe only have to upload factory firmware (bootloader). Thanks for the help.

Gerald

*/

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

// Local Network Settings
byte mac[] = { 0xD4, 0x28, 0xB2, 0xFF, 0xCA, 0x20 }; // Must be unique on local network
//IPAddress ip(XXX ,XXX ,95 ,241);
//IPAddress gateway(XXX, XXX, 95, 253);
//IPAddress subnet(255, 255, 255, 0);

// ThingSpeak Settings
char thingSpeakAddress[] = "api.thingspeak.com";
String writeAPIKey = "XXXXXXXXXXXXX";
const int updateThingSpeakInterval = 16 * 1000;      // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)

// Variable Setup
long lastConnectionTime = 0;
boolean lastConnected = false;
int failedCounter = 0;

// Initialize Arduino Ethernet Client
EthernetClient client;


void setup()
{
  // Start Serial for debugging on the Serial Monitor
  Serial.begin(9600);
 
  // Start Ethernet on Arduino
  startEthernet();
  //Ethernet.begin(mac, ip);
Ethernet.begin(mac);
delay(2000); //wait for leonardo
}

void loop()
{
  // Read value from Analog Input Pin 0
// String analogPin0 = String(analogRead(A0), DEC);
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
int temp = sensorValue * (4.19 / 1023.0)*100; // balance for 4.19 max voltage
  // print out the value you read:
String analogPin0 = String(temp, DEC);
 
  // Print Update Response to Serial Monitor
  if (client.available())
  {
  char c = client.read();
    Serial.print(c);
  }

  // Disconnect from ThingSpeak
  if (!client.connected() && lastConnected)
  {
    Serial.println("...disconnected");
    Serial.println();
   
    client.stop();
  }
 
  // Update ThingSpeak
  if(!client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval))
  {
    updateThingSpeak("field1="+analogPin0);
  }
 
  // Check if Arduino Ethernet needs to be restarted
  if (failedCounter > 3 ) {startEthernet();}
 
  lastConnected = client.connected();
}

void updateThingSpeak(String tsData)
{
  if (client.connect(thingSpeakAddress, 80))
  {       
    client.print("POST /update HTTP/1.1\n");
    client.print("Host: api.thingspeak.com\n");
    client.print("Connection: close\n");
    client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");
    client.print("Content-Type: application/x-www-form-urlencoded\n");
    client.print("Content-Length: ");
    client.print(tsData.length());
    client.print("\n\n");

    client.print(tsData);
   
    lastConnectionTime = millis();
   
    if (client.connected())
    {
      Serial.println("Connecting to ThingSpeak...");
      Serial.println();
     
      failedCounter = 0;
    }
    else
    {
      failedCounter++;
 
      Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")"); 
      Serial.println();
    }
   
  }
  else
  {
    failedCounter++;
   
    Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")"); 
    Serial.println();
   
    lastConnectionTime = millis();
  }
}

void startEthernet()
{
 
  client.stop();

  Serial.println("Connecting Arduino to network...");
  Serial.println(); 

  delay(1000);
 
  // Connect to network amd obtain an IP address using DHCP
  if (Ethernet.begin(mac) == 0)
  {
    Serial.println("DHCP Failed, reset Arduino to try again");
    Serial.println();
  }
  else
  {
    Serial.println("Arduino connected to network using DHCP");
    Serial.println();
  }
 
  delay(1000);
}
userHeadPic geraldl
2013-11-19 18:44:42 Hi Geraldl!

Send the last sketch you uploaded on the xboard?
And a picture of your hardware, with modules attached if any, and the power supply used.

Cheers
userHeadPic Jose