Show Posts
Pages: [1]
1  Topics / Home Automation and Networked Objects / Re: door opening with arduino and SIM900 on: April 28, 2013, 08:44:03 am
To interface with the SIM900, will require the at commands http://www.simcom.us/act_admin/supportfile/SIM900_ATC_V1.00.pdf, to read the text message you can use the command AT+CMGR, and serialRead to get the reply. To control the servo use the servo library (http://arduino.cc/en/Reference/Servo) and an 'if' statement on the read serial data.
I got a sim900 module last September but have not got round to using it extensively yet, (maybe summer). Here is blog which details use of a TC35 gsm modem, which uses most of the same commands as the sim900, http://denhart.dk/2012/01/21/siemens-tc35-gsm-module-arduino/. Hope this helps.
2  Using Arduino / Programming Questions / Shiftout 11-bit on: April 28, 2013, 08:14:03 am
I am thinking about using a digital volume control chip the U2429 by unisonic to control volume http://www.unisonic.com.tw/datasheet/U2429.pdf, but to control it requires a 11-bit data format (=2047) (7 data + 4 begin/end bits). The shiftout function only supports 8bit shifting (=255),  but is there a way to change it to operate upto 11bit, one way I thought of would be to shift the first 2 bits (channel select which i'll never alter), then the 7 data bits + 1 end bit and then finally the second end bit all separately, but the clock would interfere with control for the first and last sections, B00000001, BXXXXXXX1, B10000000. Anybody got any ideas apart from manually banging out the start and stops, and shifting out data?
3  Using Arduino / Project Guidance / Re: Resistors on: April 14, 2012, 08:59:27 am
There is only only one kind of resistor, you can limit both voltage and current, it depends how you wire them up. If they're in series you create a Voltage Divider, if in parallel you create a current divider.

http://www.kpsec.freeuk.com/resistan.htm
4  Using Arduino / Project Guidance / Re: PS/2 keyboard + LCD wireless communicator on: April 14, 2012, 06:02:05 am
I realised my error as soon as I posted. Here is my completly amended code.

Code:
/*
*****************
Woozle - 2012
*****************
*/
#include <LiquidCrystal.h>    //LCD libary
#include <PS2Keyboard.h>      //PS2 libary
String buff;                  // Buffer for PS/2 data
LiquidCrystal lcd(10, 9, 5, 6, 7, 8);  //LCD initialize
PS2Keyboard kb;                        //Keyboard initialize

void setup()
{
  kb.begin(4, 3);          // Set up the keyboard
  lcd.begin(16, 2);        // Set up the LCD
  Serial.begin(9600);      // Start Serial at 9600bps
}

void loop()
{
 
  if (Serial.available())     // Check if data is available
  {   
    delay(100);        // Wait for all data to arrive from PC
    lcd.setCursor(0,0);
    lcd.write("                ");       // Clear LCD top line
    lcd.setCursor(0,0);
    while(Serial.available() > 0) // While data is available
    { 
      lcd.write(Serial.read());    // Write it to screen
    }
  }
   if (kb.available())   // Check for incoming keyboard keystrokes
   { 
     
     char x = kb.read();   
     unsigned int y = buff.length();    //Length of buffer
     if (x == PS2_ENTER)                   //If return key is pressed
     {
      Serial.println(buff);                // Send the buffer over serial
      lcd.setCursor(0,1);                  // Set the cursor on bottom line
      lcd.write("                ");       // Clear LCD bottom line
      buff = "";                           // Clear the buffer
     }
    else
     {
      buff.concat(x);      // Add variable to end of string     
      lcd.setCursor(y,1);        //Postition that PS/2 data will be written to
      lcd.write(x);              // Send to LCD
     }
   }
}
I used 'l' for the next part. It has now been changed to 'y' because I got it mixed up with a 1. I don't know how to erase the last character of a String though so I have not been able to get the 'backsparce' working. Any ideas?
5  Using Arduino / Project Guidance / Re: PS/2 keyboard + LCD wireless communicator on: April 13, 2012, 06:59:43 am
Ok, so I have started editing the code, debugging as I went along along and already I seem to have a problem. I started by just setting up buffer as a string and by setting up the Return key to send the buffer over serial. But the data appears to the LCD as black filled-in boxes and when return is pressed the Buffer appears as the correct length of characters but all as 'ΓΏ's.
Code:
#include <LiquidCrystal.h>    //LCD libary
#include <PS2Keyboard.h>      //PS2 libary
String buff;        // Buffer for PS/2 data
LiquidCrystal lcd(10, 9, 5, 6, 7, 8);  //LCD initialize
PS2Keyboard kb;                        //Keyboard initialize
//Same here as before
if (kb.available())   // Check for incoming keyboard keystrokes
   { 
     char x = kb.read();  // Write keystrokes to a variable
     
     if (x == PS2_ENTER)
     {
      Serial.print(buff);
     }
     
     else
     {
      char x = kb.read();  // Write keystrokes to a variable
      buff.concat(x);      // Add variable to end of string
      byte l = buff.length();    //Length of buffer
      lcd.print(x);     // Send to LCD
     }
   }

Any ideas on why this is happening?
6  Using Arduino / Project Guidance / Re: PS/2 keyboard + LCD wireless communicator on: April 13, 2012, 05:39:42 am
Thank you, thats just what I needed, I will edit the code now and repost it when I have done it.
7  Using Arduino / Project Guidance / PS/2 keyboard + LCD wireless communicator on: April 12, 2012, 04:35:00 pm
I have recently built my first 'proper' Arduino based project which is a wireless communicator gadget (see attachment). It basicly is a keyboard + LCD connected to an ATMEGA328 running 2009 bootloader connected to a transparent serial tranciever (Ciesco XRF). On the other end I have another XRF connected through an FTDI to my PC.
Code:
/*
*****************
Woozle - 2012
*****************
*/

#include <LiquidCrystal.h>    //LCD libary
#include <PS2Keyboard.h>      //PS2 libary

LiquidCrystal lcd(10, 9, 5, 6, 7, 8);  //LCD initialize
PS2Keyboard kb;                        //Keyboard initialize

void setup()
{
  kb.begin(4, 3);          // Set up the keyboard
  lcd.begin(16, 2);        // Set up the LCD
  Serial.begin(9600);      // Start Serial at 9600bps
}

void loop()
{
  if (Serial.available())     // Check if data is available
  {   
    delay(100);        // Wait for all data to arrive from PC
    lcd.clear();       // Clear LCD display
    while (Serial.available() > 0) // While data is available
    { 
      lcd.write(Serial.read());    // Write it to screen
    }
  }
   if (kb.available())   // Check for incoming keyboard keystrokes
   { 
    char x = kb.read();  // Write keystrokes to a variable
    Serial.print(x);     // Send to PC
   }
}

This works well for bi-directional communication between the PC and 'the device' but I was wondering how to have the device print the keyboard's message (in a sort of buffer) on the second line of the LCD and allow for corrections (backspace) before being sent over serial by pressing enter. Thanks in advance for any replies.

PS. This is my first forum post so if I have done anything wrong (code etiquette etc) please tell me.
Pages: [1]