Show Posts
Pages: [1] 2 3 ... 10
1  Using Arduino / Networking, Protocols, and Devices / Re: Adafruit CC33000 Library WebClient Local PHP on: March 14, 2014, 09:51:40 am
good catch, but when i fixed that, same results
2  Using Arduino / Networking, Protocols, and Devices / Adafruit CC33000 Library WebClient Local PHP on: March 13, 2014, 05:19:23 pm
Hello,
I'm attempting to retrieve some phps from my new Adafruit CC3000 Library using the Webclient example and it works fine for all "internet" sites but I can't seem to get it to work for my local server.

Here is my Arduino Code:
Code:
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"

// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ   3  // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,SPI_CLOCK_DIVIDER);

#define WLAN_SSID       "MikroTik"
#define WLAN_PASS       "7409721385"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2

//#define WEBSITE "http://192.168.88.240"
//#define WEBPAGE "/Home_Automation/checkStatus.php?DeviceCount=3&Type=Toggles&Device0=HVAC_Fan&Device1=HVAC_Ac&Device2=HVAC_Heat"

#define WEBSITE      "192.168.88.240"
#define WEBPAGE      "/home_automation/test.php"

#define IDLE_TIMEOUT_MS  3000      // Amount of time to wait (in milliseconds) with no data
                                   // received before closing the connection.  If you know the server
                                   // you're accessing is quick to respond, you can reduce this value.
uint32_t ip = cc3000.IP2U32(192, 168, 88, 240);

void setup()
{
  Serial.begin(57600);
  CC3000_setup();
  WebRequest();
}

void loop()
{}

void CC3000_setup()
{
  Serial.println(F("Hello, CC3000!\n"));

  displayDriverMode();
  Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
 
  /* Initialise the module */
  Serial.println(F("\nInitialising the CC3000 ..."));
  if (!cc3000.begin())
  {
    Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
    while(1);
  }
 
  uint16_t firmware = checkFirmwareVersion();
  if ((firmware != 0x113) && (firmware != 0x118)) {
    Serial.println(F("Wrong firmware version!"));
    for(;;);
  }
 
  displayMACAddress();
 
  /* Delete any old connection data on the module */
  Serial.println(F("\nDeleting old connection profiles"));
  if (!cc3000.deleteProfiles()) {
    Serial.println(F("Failed!"));
    while(1);
  }

  /* Attempt to connect to an access point */
  char *ssid = WLAN_SSID;             /* Max 32 chars */
  Serial.print(F("\nAttempting to connect to ")); Serial.println(ssid);
 
  /* NOTE: Secure connections are not available in 'Tiny' mode! */
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    Serial.println(F("Failed!"));
    while(1);
  }
   
  Serial.println(F("Connected!"));
 
  /* Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP())
  {
    delay(100); // ToDo: Insert a DHCP timeout!
  } 

  /* Display the IP address DNS, Gateway, etc. */ 
  while (! displayConnectionDetails()) {
    delay(1000);
  }
}


/**************************************************************************/
/*!
    @brief  Displays the driver mode (tiny of normal), and the buffer
            size if tiny mode is not being used

    @note   The buffer size and driver mode are defined in cc3000_common.h
*/
/**************************************************************************/
void displayDriverMode(void)
{
  #ifdef CC3000_TINY_DRIVER
    Serial.println(F("CC3000 is configure in 'Tiny' mode"));
  #else
    Serial.print(F("RX Buffer : "));
    Serial.print(CC3000_RX_BUFFER_SIZE);
    Serial.println(F(" bytes"));
    Serial.print(F("TX Buffer : "));
    Serial.print(CC3000_TX_BUFFER_SIZE);
    Serial.println(F(" bytes"));
  #endif
}

/**************************************************************************/
/*!
    @brief  Tries to read the CC3000's internal firmware patch ID
*/
/**************************************************************************/
uint16_t checkFirmwareVersion(void)
{
  uint8_t major, minor;
  uint16_t version;
 
#ifndef CC3000_TINY_DRIVER 
  if(!cc3000.getFirmwareVersion(&major, &minor))
  {
    Serial.println(F("Unable to retrieve the firmware version!\r\n"));
    version = 0;
  }
  else
  {
    Serial.print(F("Firmware V. : "));
    Serial.print(major); Serial.print(F(".")); Serial.println(minor);
    version = major; version <<= 8; version |= minor;
  }
#endif
  return version;
}

/**************************************************************************/
/*!
    @brief  Tries to read the 6-byte MAC address of the CC3000 module
*/
/**************************************************************************/
void displayMACAddress(void)
{
  uint8_t macAddress[6];
 
  if(!cc3000.getMacAddress(macAddress))
  {
    Serial.println(F("Unable to retrieve MAC Address!\r\n"));
  }
  else
  {
    Serial.print(F("MAC Address : "));
    cc3000.printHex((byte*)&macAddress, 6);
  }
}


/**************************************************************************/
/*!
    @brief  Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
 
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
  {
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
  }
  else
  {
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    Serial.println();
    return true;
  }
}

/**************************************************************************/
/*!
    @brief  Begins an SSID scan and prints out all the visible networks
*/
/**************************************************************************/

void listSSIDResults(void)
{
  uint8_t valid, rssi, sec, index;
  char ssidname[33];

  index = cc3000.startSSIDscan();

  Serial.print(F("Networks found: ")); Serial.println(index);
  Serial.println(F("================================================"));

  while (index) {
    index--;

    valid = cc3000.getNextSSID(&rssi, &sec, ssidname);
   
    Serial.print(F("SSID Name    : ")); Serial.print(ssidname);
    Serial.println();
    Serial.print(F("RSSI         : "));
    Serial.println(rssi);
    Serial.print(F("Security Mode: "));
    Serial.println(sec);
    Serial.println();
  }
  Serial.println(F("================================================"));

  cc3000.stopSSIDscan();
}

void WebRequest()
{
  Adafruit_CC3000_Client www = cc3000.connectTCP(ip, 80);
  if (www.connected()) {
    www.fastrprint(F("GET "));
    www.fastrprint(WEBPAGE);
    www.fastrprint(F(" HTTP/1.1\r\n"));
    www.fastrprint(F("Host: ")); www.fastrprint(WEBSITE); www.fastrprint(F("\r\n"));
    www.fastrprint(F("\r\n"));
    www.println();
  } else {
    Serial.println(F("Connection failed"));   
    return;
  }

  Serial.println(F("-------------------------------------"));
 
  /* Read data until either the connection is closed, or the idle timeout is reached. */
  unsigned long lastRead = millis();
  while (www.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
    while (www.available()) {
      char c = www.read();
      Serial.print(c);
      lastRead = millis();
    }
  }
  www.close();
  Serial.println(F("-------------------------------------"));
 
  /* You need to make sure to clean up after yourself or the CC3000 can freak out */
  /* the next time your try to connect ... */
  Serial.println(F("\n\nDisconnecting"));
  cc3000.disconnect();
}

Code:
My HTML code:

My output is the following:
Code:
Hello, CC3000!

RX Buffer : 131 bytes
TX Buffer : 131 bytes
Free RAM: 6697

Initialising the CC3000 ...
Firmware V. : 1.24
MAC Address : 0x08 0x00 0x28 0x59 0x25 0x15

Deleting old connection profiles

Attempting to connect to MikroTik
Started AP/SSID scan




Connecting to MikroTik...Waiting to connect...Connected!
Request DHCP

IP Addr: 192.168.88.209
Netmask: 255.255.255.0
Gateway: 192.168.88.1
DHCPsrv: 192.168.88.1
DNSserv: 192.168.88.1


Connect to 192.168.88.240:80
-------------------------------------
-------------------------------------


Disconnecting


This is really annoying me and I can't figure out why it's not working, please help!! smiley-grin
3  Using Arduino / Project Guidance / 30W 42V LED Driver w/ Dimming by Arduino on: January 17, 2014, 04:08:10 pm
Hello!

I am trying to wrap my head around LED lighting and have done a good amount of research into LEDEngin's LED emitter modules.  I have my eye on the 30W emitter but this has a forward voltage of 42V (here it is http://www.mouser.com/ProductDetail/LED-Engin/LZC-C0WW00/?qs=sGAEpiMZZMu4Prknbu83yxmdW0DL2XhYFIkVLBVIvVQ%3d).  What are my options for powering such a device?  Part of the requirement though is being able to dim the LED from an arduino via PWM.  I have plenty of power at the 12V range but it seems getting this up to the 42V level would be quite challenging and/or expensive.  And since this is supposed to be something where there is supposed to be many around the house, price is a considerable factor.

Thanks for all replies!
4  Using Arduino / Programming Questions / Re: EthernetUdp Sending Sensor Data on: January 13, 2014, 10:45:17 am
So with toCharArray I can build a string and then write it to the socket as such?
In what format will other side pick it up as? String?
5  Using Arduino / Programming Questions / EthernetUdp Sending Sensor Data on: January 13, 2014, 10:35:58 am
Hello!

I have a couple of sensors that I am trying to send out over a UDP socket to processing but I am having trouble concatenating a string together and sending it out.

For example, I am trying to read in Analogs 0-3, and concatenating as such:
Code:
String data = "*" + analogRead(0) + "/" + ... + analogRead(3)
But then another problem is that I need to send it over Udp via Udp.write() but that only seems to except character arrays.  So how do I accomplish this?
6  Using Arduino / Project Guidance / Cheap Current Sensing/Feedback on: January 03, 2014, 03:37:05 pm
Hello,
I have many automated devices in my home via arduino/processing/web/blah blah blah but my biggest issue is not knowing (via arduino) if the actual device is on or not.  I have created a board with a couple ACS712s on it to sense current but it's somewhat of an expensive process.  So my question is, is there an easier way to receive feedback from the lamps/tvs/dc devices/other home crap that are largely controlled by relays so that the arduino can know if it was successful?
7  Using Arduino / Project Guidance / Re: Arduino Remote Car Starter on: October 18, 2013, 12:19:52 pm
that makes sense
Thanks!
8  Using Arduino / Project Guidance / Re: Arduino Remote Car Starter on: October 18, 2013, 08:04:00 am
no one here seems very supportive of such an idea.  i can't really do an electric heater type option as i am at an apartment and i can't run an electrical cord out to the car.

also, why would you consider leaving a car to "warm up" while running idle a bad idea?
9  Using Arduino / Project Guidance / Re: Arduino Remote Car Starter on: October 15, 2013, 09:23:45 am
Quote
Make sure that what you're proposing is safe and legal before you start. At a minimum, you would need to have a neutral lock-out so that it could not be started in gear. Here in the UK it would be illegal since it is not legal to leave a running vehicle unattended, and if it had been legal I would have expected insurers to be extremely interested in a modification which makes it possible to start the car without a driver in it, and enables somebody without a key to start it.
I am in the US and I would assume that it is legal since you see commercials all over the place regarding On-Star starting cars remotely and getting them warmed up for you the morning (which is my purpose) as well as remote car starter kits all over american websites.  But thats a good point, I'll have to take a further look into that and the insurance side.

Quote
Once you have overcome those issues, in order to get it to work you will also need to disarm whatever alarm/immobiliser your car may have installed. Not a problem if you don't have one, but most cars do these days.
My 06 doesnt have an alarm but I'm not sure about an immobiliser.  How could I tell?

Any ideas on how to get wiring schematics and such for my vehicle? or information on my ECM?
10  Using Arduino / Project Guidance / Arduino Remote Car Starter on: October 15, 2013, 08:29:46 am
Hello,
I am tinkering with the idea of building a remote control starter but am unsure of all of the aspects involved in doing so.  I have been reading through the following instructable:
http://www.instructables.com/id/Remote-Car-Starter-using-Bluetooth/
and it seems do-able.  However, is it as simple as just putting 3 relays in parallel with the ignition/starter/accessory control wires?  Where can I find documentation on my car (06 accord coupe) such as ECM info and wiring diagrams?

Does anyone here have experience with this?  A google search didn't seem to pull up much and this surely has been done before.  Also, I am trying to do this from scratch, not buying a aftermarket unit and just grounding a wire (unless that is more cost effective).  I already have most of the components necessary such as:
-bluetooth
-pro/dum/mega boards
-mosfets
-various relays
which is why i think doing it from scratch would be more cost effective.

Any Help is greatly appreciated!!
11  Using Arduino / Sensors / Re: Arduino Water Cooling Temperature Sensor on: September 20, 2013, 12:38:34 pm
thanks but no thanks!  smiley-sweat
that is way too risky for me and waaay beyond my ability and comfort zone.
12  Using Arduino / Sensors / Re: Arduino Water Cooling Temperature Sensor on: September 20, 2013, 12:26:36 pm
okay thanks!
and you are one hundred percent sure that it is simply a thermistor?
Will the arduino have good enough ADC resolution to pick up minor changes in water temperature? i.e +/- 0.5 degree Celsisus
13  Using Arduino / Sensors / Re: Arduino Water Cooling Temperature Sensor on: September 20, 2013, 10:36:07 am
That wouldn't work as I am trying to get the temperature of the water in the loop.
14  Using Arduino / Sensors / Re: Arduino Water Cooling Temperature Sensor on: September 20, 2013, 09:19:32 am
Yeah I saw that but how would I go about putting it into the loop?
15  Using Arduino / Sensors / Arduino Water Cooling Temperature Sensor on: September 20, 2013, 08:49:39 am
Hello

I am trying to find a way to measure the water temperature of my computer water cooling loop.  I currently have built a fan controller that is controlled from the arduino to keep fan speed down to a minimum and yet cpu/gpu temps to a reasonable level.  However, I would like a method to sense the temperature of the water via hardware.  The only kind of thing I have found is this:
http://koolance.com/sen-tpl010k-coolant-temperature-sensor-10k-ohm
But I am not sure on how I could connect that to the arduino.

Thank you for ALL responses!!
Pages: [1] 2 3 ... 10