Show Posts
Pages: 1 2 3 [4] 5 6 ... 39
46  Using Arduino / Project Guidance / IR remote controller project with low power? on: November 28, 2013, 07:14:46 pm
Hi all. I would like to make a IR remote controller and run it off batteries - maybe 2 AA cells? The IR part should be fine, but I'm not sure about how to achieve the lowest power consumption possible. I will be using a 328P - because I have a few around the place and also I will probably use most of the digital inputs to read buttons. This means that 99% of the time the 328 would be idle, but always checking pin state changes.

Any advice would be gratefully received smiley
47  Community / Exhibition / Gallery / Re: GPS time-date on: November 28, 2013, 08:12:47 am
great idea, thanks for sharing
48  Community / Exhibition / Gallery / Re: Arduino + Ethernet + DHT22 temperature sensor controlled by Android app on: November 28, 2013, 08:01:35 am
looks great! how do I install the android app?
49  Community / Exhibition / Gallery / Re: Li-poly powered 2.6W LED road flares :) -homemade PCB and pictures on: November 28, 2013, 08:00:56 am
looks good, very well done smiley I have used press and peel before - nightmare to get it to stick without it getting too hot sometimes

Thanks for sharing
50  Community / Exhibition / Gallery / Re: Internet of Things (IoT) Relayduino (Arduino Compatible I/O Board) Project on: November 06, 2013, 07:52:10 pm
very cool, thanks for sharing!
51  Community / Exhibition / Gallery / Re: New solar project: Minimalistic system on: October 15, 2013, 10:42:53 am
Very interesting, thank you for sharing
52  Using Arduino / Programming Questions / Re: two pages from ethernet shield? on: October 15, 2013, 08:40:14 am
How does the arduino know which html to send once it receives a request? In the example code I'm using all of the HTML gets sent to the browser. I'd like to have a second chunk of html that is sent.

Sorry I wasn't clear about page titles I mean't default pages in root directories on the web are called index or default.html, I'm just confused how one would structure code to put placed under another title, for example a page called data.html.

I'm still at a loss as to how all this could be organised into a secondary page. I will try and do some more research, thanks for the help so far
53  Using Arduino / Programming Questions / Re: two pages from ethernet shield? on: October 15, 2013, 06:16:48 am
I understand basic HTML, usually you have to put HMTL files on a webserver, then you can simply request them by pointing to them as I'm sure you are well aware.

However I'm not sure how this would work from an arduino. I guess the first page that gets served is the same as index.html or default.html - If I add a link to display in the page served by the arduino, where do I point it?

Also how do I define the page titles? From what I can see in the code that I'm using there is nothing to define that it should be titled index or default.html?

Thanks for the help
54  Using Arduino / Programming Questions / Re: two pages from ethernet shield? on: October 15, 2013, 04:09:03 am
Sorry I'm not sure what you mean with that stuff - could you elaborate? The code is from a tutorial so I don't fully understand it.

I't just confused how I could code the html to point to a new page and the arduino to interpret the request - then serve a different page?

Thanks
55  Using Arduino / Programming Questions / two pages from ethernet shield? on: October 15, 2013, 03:34:26 am
Hi all. I have been playing with a basic page coming from my arduino which I have been using to switch things on and off. I would ideally like to have at least one other page for some settings, so I would like to be able to click a link from the main page that the arduino serves up to then display a second one?

I am working with a slightly expanded version of this code

Code:
//simple button GET server code to control servo and arduino pin 5
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html
//for use with W5100 based ethernet shields
//Powering a servo from the arduino usually DOES NOT WORK.
//note that the below bug fix may be required
//http://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/step2/Connected/
// http://code.google.com/p/arduino/issues/detail?id=605
//http://www.instructables.com/id/Arduino-Control-via-a-Web-Service-with-Teleduino/?ALLSTEPS
 
#include <SPI.h>
#include <Ethernet.h>
 
#include <Servo.h>
Servo myservo;  // create servo object to control a servo
 
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 0, 177 }; // ip in lan
byte gateway[] = { 192, 168, 0, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
 
String readString;
 
//////////////////////
 
void setup(){
 
  pinMode(6, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();
  //the pin for the servo co
  //enable serial data print
  Serial.begin(9600);
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded
}
 
void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
 
        //read char by char HTTP request
        if (readString.length() < 100) {
 
          //store characters to string
          readString += c;
          //Serial.print(c);
        }
 
        //if HTTP request has ended
        if (c == '\n') {
 
          ///////////////
          Serial.println(readString); //print to serial monitor for debuging
 
          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();
 
          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
          client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
          client.println("<link rel='stylesheet' type='text/css' href='http://chriscosma.co.cc/a.css' />");
          client.println("<TITLE>Home Automation</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");
          client.println("<H1>Home Automation</H1>");
          client.println("<hr />");
          client.println("<br />");
         
          client.println("<a href=\"/?lighton\"\">Turn On Light</a>");
          client.println("<a href=\"/?lightoff\"\">Turn Off Light</a><br />");       
 
          client.println("</BODY>");
          client.println("</HTML>");
 
          delay(1);
          //stopping client
          client.stop();
 
          ///////////////////// control arduino pin
          if(readString.indexOf("?lighton") >0)//checks for on
          {
            digitalWrite(6, HIGH);    // set pin 4 high
            Serial.println("Led On");
            client.println("<link rel='apple-touch-icon' href='http://chriscosma.co.cc/on.png' />");
          }
          else{
          if(readString.indexOf("?lightoff") >0)//checks for off
          {
            digitalWrite(6, LOW);    // set pin 4 low
            Serial.println("Led Off");
            client.println("<link rel='apple-touch-icon' href='http://chriscosma.co.cc/off.png' />");
          }
          }
          //clearing string for next read
          readString="";
 
        }
      }
    }
  }
}
56  Using Arduino / Programming Questions / Re: Display battery state of charge graphic on LCD on: October 07, 2013, 08:23:02 am
Just thought of a more efficient way that I could adjust my code, I could draw a empty battery on the LCD then just write over it with the segments that need to be filled in, should make the code a little smaller!

I will still be trying Hazards method though smiley
57  Using Arduino / Programming Questions / Re: Display battery state of charge graphic on LCD on: October 07, 2013, 05:10:36 am
thanks, I will load it up later and try and work out how you have done it smiley
58  Using Arduino / Programming Questions / Re: Display battery state of charge graphic on LCD on: October 05, 2013, 09:56:45 pm
Result, I have got it doing exactly what I wanted it to do. but the code is very over the top, clumsy and probably stupidly inefficient - how could it be optimized?



The whole code is to long to post but this gives you an idea of the section i need to improve :
Code:
soc = map(((vin*10) + 2), (underVoltage*10), 126, 0, 16);  // Scale up number and add small offset, then map to 1-16
    soc = max(soc, 0);
    soc = min(soc, 16);

    if (soc == 0)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)3);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    if (soc == 1)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)7);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    if (soc == 2)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    if (soc == 3)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    if (soc == 4)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    if (soc == 5)
    {
      lcd.setCursor(0, 1);

      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)7);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)4);
      lcd.write((uint8_t)5);
    }

    }
59  Using Arduino / Programming Questions / Re: Display battery state of charge graphic on LCD on: October 05, 2013, 08:13:40 pm
Thanks! I took me a while to grasp what you were saying but it makes sense now. I thought the values might get scaled up or something.

This works now.. time to start working out the LCD bit smiley

Code:
int analoginput = A1;
int soc = 0;

float vin = 0.0;


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



void loop(){
  vin = analogRead(analoginput)*5.09/1024*3.15;
  soc = map((vin*10), 93, 126, 0, 15);
  soc = max(soc, 0);
 
  Serial.print("Vin: ");
  Serial.print(vin);
  Serial.print("V  SOC: ");
  Serial.println(soc);
 
  delay(1400);
}
60  Using Arduino / Programming Questions / Re: Display battery state of charge graphic on LCD on: October 05, 2013, 07:14:12 pm
Hi, thanks for the reply. I forgot to say I'm using a 16x2 LCD in parallel mode.

Thanks, I have just read through that thread, It is a similar concept to some test code that I have just written.

I have tested it and it doesn't work as I had hoped, the SOC only displays 0, 5, 10 or 15 and no increments inbetween?

Code:
int analoginput = A1;
int soc = 0;
float vin = 0.0;

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

void loop(){
  vin = analogRead(analoginput)*5.09/1024*3.15;
  soc = map(vin, 9.3, 12.6, 0, 15);
  //soc = constrain(soc, 0, 15);
  Serial.print(vin, 3);
  Serial.print("  ");
  Serial.println(soc);
  delay(1400);
}



Pages: 1 2 3 [4] 5 6 ... 39