Tuesday 23 September 2014

"Text displaying device" progres

Having encountered a few problems as the GSM shield and the DMD display share the same pins.
We were trying to modify the libraries to assign the pins to different locations. Janitha found out that the only pins that are shared are - pin 9 only (A PWM pin).

Janitha came up with the excellent idea of using two Arduinos together...

This method uses one Arduino to run the GSM shield and one to run and control the DMD shield. The GSM linked Arduino pushes the serial signal through Tx/Rx to the DMD Arduino. Great solution - Programming next!


Tuesday 5 August 2014

Hexapod Testing

Here is the first video of the hexapod moving. Each of the 18 motors needs to be co-ordinated for the hexapod to walk or perform movements.


Hexapod progress

Here is a photo of the hexapod progress. Randipa is currently programming the USB controller to operate the 18 individual motors. Once we have some movement, we'll post it here...
(Ignore the date on the photo - the camera is wrong!)




Tuesday 1 July 2014

Codebender.cc

codebender.cc is a free online Arduino specific programming environment. You can create, edit, and share code in your browser, then store it in the cloud. Then when you are done you can upload it to an Arduino directly from your browser via a free browser plugin.

Tuesday 24 June 2014

GSM Shield

We made a major breakthrough today. We got the GSM shield working. Initially, we were concerned as we had heard that the GSM shield could draw up to 2A of current. This would not do an Arduino much good, so it seemed to be a bit of a risk.
We connected the Arduino to the USB on a computer and used a GSM example to send a text...

/*
 SMS sender

 This sketch, for the Arduino GSM shield,sends an SMS message
 you enter in the serial monitor. Connect your Arduino with the
 GSM shield and SIM card, open the serial monitor, and wait for
 the "READY" message to appear in the monitor. Next, type a
 message to send and press "return". Make sure the serial
 monitor is set to send a newline when you press return.

 Circuit:
 * GSM shield
 * SIM card that can send SMS

 created 25 Feb 2012
 by Tom Igoe

 This example is in the public domain.

 http://arduino.cc/en/Tutorial/GSMExamplesSendSMS

 */

// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup()
{
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
 
  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
 
  Serial.println("GSM initialized");
}

void loop()
{

  Serial.print("Enter a mobile number: ");
  char remoteNum[20];  // telephone number to send sms
  readSerial(remoteNum);
  Serial.println(remoteNum);
   
  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);
 
  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[])
{
  int i = 0;
  while(1)
  {
    while (Serial.available() > 0)
    {
      char inChar = Serial.read();
      if (inChar == '\n')
      {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if(inChar!='\r')
      {
        result[i] = inChar;
        i++;
      }
    }
  }
}

We found that there was an issue with the serial print in the script. When the serial monitor was "Asking" for a number and we typed it in, the script didn't work. When Brodie rewrote the script to include a stated number it sent a text message. In fact it continued to send messages...
Ten of them in a minute. This of course isn't a problem as the script is simply doing what it is told to do.
Next stage back to getting the dot matrix LED screen to display through the serial monitor...
The GSM needs it's metadata removing too - we don't want that to be displayed.

Sunday 1 June 2014

Updates to Arduino IDE

The Arduino web site has details of the upcoming release of the latest version of their IDE.
Current version is 1.05. Version 1.5 has been released in BETA. If you are really brave there are nightlies too...
Arduino 1.5.6-r2 BETA

Thursday 29 May 2014

HTML to LCD via arduino

This might be a workaround to get text onto an LCD or LED dotmatrix for the code-shy among us...
http://everettsprojects.com/2011/05/19/arduino-project-html-to-lcd/

Twitter RSS Feeds

As you might have found out, Twitter changed their API code meaning that many Arduino Sketches that call twitter timelines no longer work.
This may be of use, as it converts twitter timelines to rss...
https://www.youtube.com/watch?v=BXLYIw-IU8I#t=70
Could also be useful and seems quite simple..
http://twss.55uk.net/



Saturday 24 May 2014

Twitter Client to post CSC Sports news on a DOT MATRIX LED screen

The twitter API code changed at some stage - 2013? Most twitter arduino sketches do not work for this reason.
ArduinoForProjects has this page...
http://duino4projects.com/displaying-twitter-feed-without-a-pc-using-arduino/
With this code for download. As it might be a problem to download the code at school, here is the sketch...

/*
 * Twitter2LCD
 * gets xml data from http://twitter.com/statuses/user_timeline/16297873.rss
 * reads the most recent tweet from field:  <title>
 * writes the output to the LCD.

 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 See more here:
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */


#include <Ethernet.h>
#include <EthernetDHCP.h>
#include <TextFinder.h>
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte server[] = {128,242,240,20}; // Twitter

char tweet[140];

Client client(server, 80);

TextFinder  finder( client );

void setup()
{
  lcd.begin(20,4);
  lcd.clear();
  lcd.print("Twitter2LCD");
  Serial.begin(9600);
  EthernetDHCP.begin(mac);
}


void loop()
{
  lcd.clear();
  if (client.connect()) {
    client.println("GET http://www.twitter.com/statuses/user_timeline/16297873.rss HTTP/1.0");  // twitter rss for fgranelli
    client.println();
  }
  else {
    lcd.println("Connection failed");
    Serial.println("Connection failed");
  }
  if (client.connected()) {
     // get the last tweet by simply parsing the item and title tags
     if((finder.find("<item>")&&(finder.getString("<title>","</title>",tweet,140)!=0)))
     {
         Serial.println(tweet);
       
         for (int j=0; j<2; j++) {
           // first part of the tweet
           lcd.clear();
           lcd.setCursor(0,0);
           for (int i=0; i<20; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,1);
           for (int i=20; i<40; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,2);
           for (int i=40; i<60; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,3);
           for (int i=60; i<80; i++)
             lcd.print(tweet[i]);
           delay(10000);
           // second part of the tweet
           lcd.clear();
           lcd.setCursor(0,0);
           for (int i=60; i<80; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,1);
           for (int i=80; i<100; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,2);
           for (int i=100; i<120; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,3);
           for (int i=120; i<140; i++)
             lcd.print(tweet[i]);
           delay(10000);
           }
     }
    else
      lcd.println("Could not find item field");
  }
  else {
    lcd.println("Disconnected");
  }
  client.stop();
  client.flush();
  delay(60000); // wait a minute before next update
}

Tuesday 20 May 2014

Serial Print

The next steps for our "Sports Results Display" will be getting the LED screen to print SERIAL.

Having done this, we think that the following steps will be needed:
  1. Get LED screen to print through serial.
  2. Find information about setting up through ethernet and Twitter.
  3. Find out how Twitter accounts work.
  4. Set up a twitter account and experiment.
Having had big problems connecting, we have decided not to use Mr Jagoutz's laptop. We spent the whole lesson trying to connect the Uno but no luck...

Next step is to load Arduino IDE onto computers in T4.

Tuesday 8 April 2014

Arduino LCD - Scrolling Text on a Large Display

Very exciting today - our large led matrix display arrived...
After initial problems with the Arduino Ide not synching correctly with my laptop we managed to get the laptop to see the Arduino on the correct COM port. We hope to get Arduino IDE across all the computers in Technology eventually.


We got started setting it up. It came with an instruction sheet which was very helpful in getting it up and running.





Connecting the board with an Arduino Uno proved to be pretty easy. Just connect the supplied ribbon cable the correct way around an its all linked up. Power is taken from the Arduino board itself, so convenient but can also be made brighter with the addition of an external power supply at 5V.


Getting the libraries into the Arduino IDE was pretty easy too.


A guide is available for you to see...
http://cdn.shopify.com/s/files/1/0045/8932/files/DMD_Getting_Started.pdf?100647


Once the libraries were installed into the correct place, we fired up a couple of example files to see what we would be able to do.


Scrolling text to announce sports results was what we really wanted, so we looked at thje code and made a few modifications...




 To do so, have your sketch first assemble the text to display into a String variable. The maximum length is 255 characters. Or you can just have a fixed value, for example:
String textToScroll = "Hello, this is a really long length of text";
You will also need the following function in your sketch:
void drawText(String dispString) 
{
  dmd.clearScreen( true );
  dmd.selectFont( Arial_Black_16 );
  char newString[256];
  int sLength = dispString.length();
  dispString.toCharArray( newString, sLength+1 );
  dmd.drawMarquee(newString,sLength,( 32*DISPLAYS_ACROSS )-1 , 0 );
  long start=millis();
  long timer=start;
  long timer2=start;
  boolean ret=false;
  while(!ret){
    if ( ( timer+20 ) < millis() ) {
      ret=dmd.stepMarquee( -1 , 0 );
      timer=millis();
    }
  }
}
Then to scroll the text, simply call the function as required, for example:
drawText(textToScroll);
The following is the total sketch for a basic text-scrolling application using the function from above:
#include "SPI.h"        
#include "DMD.h"        
#include "TimerOne.h"
#include "Arial_black_16.h" 
/* you can remove the fonts if unused */
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd( DISPLAYS_ACROSS , DISPLAYS_DOWN );

void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}

void setup()
{
   Timer1.initialize( 5000 );           
   Timer1.attachInterrupt( ScanDMD );  
   dmd.clearScreen( true );            
}

String textToScroll="Hello, this will be displayed on the DMD";

void drawText( String dispString ) 
{
  dmd.clearScreen( true );
  dmd.selectFont( Arial_Black_16 );
  char newString[256];
  int sLength = dispString.length();
  dispString.toCharArray( newString, sLength+1 );
  dmd.drawMarquee( newString , sLength , ( 32*DISPLAYS_ACROSS )-1 ,0);
  long start=millis();
  long timer=start;
  long timer2=start;
  boolean ret=false;
  while( !ret ){
    if ( ( timer+20 ) < millis() ) {
      ret=dmd.stepMarquee( -1 , 0 );
      timer=millis();
    }
  }
}

void loop()
{
  drawText(textToScroll);
}






Arduino Libraries are kept on github here...
https://github.com/freetronics/DMD


Brodie managed to get the text to scroll across the screen and also managed to change the speed which is cool. We are still not certain that the average user would be able to get text onto this easily, as it requires code-level operation. The best scenario would be to be able to send text to the internet somehow, then for the 'net connected board to simply display it.













Thursday 3 April 2014

Arduino LCD


After Mr Jagoutz asked me if I would like to help him [build]  a project of his -An LCD display that could be hung in the school office window and used to display school news/temperature/sports results - I was excited, because working with a teacher presented me with a unique opportunity to learn from [Mr Jagoutz] as we worked.

After some research I found a large LED matrix display⁴ from JayCar with a build in controller that was Arduino  compatible.

We (Myself & Mr Jagoutz) decided that before we committed to buying the display, we would try to do something similar but with one of the schools small 16x2 LCD displays⁵.

The following is the result of the above endevour:



While in activities on Wednesday afternoon I altered an example sketch I had gotten from the LCD shield manufacturers website⁷, This is the "Hello Mr Jag, It's working" examples. I ask if I could borrow the LCD shield, and once I got home, booted into Ubuntu and started coding. I wrote my own sketch from scratch - the flashing "Hello World".  And then altered one of the example sketches (Examples>LiquidCrystal>SerialDisplay) to send text to the Arduino.

 jaycar.co.nz/productView.asp?ID=XC4250&w=dot+matrix+display&form=KEYWORD
www.dfrobot.com/index.php?route=product/product&product_id=51
www.dfrobot.com/wiki/index.php?title=Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)


Tuesday 25 March 2014



After discussing methods of creating custom circuit boards to use with are Arduino projects, and Mr Jagoutz suggest Fritzing - Designing PCB's on the computer and then sending the files away for printing. Mr Jagoutz also recounted an anecdote from his youth in which he and some of his pears would make circuit board via an acid etching process. I remember reading about conductive 3D printing filament. Here is a link to a product that I found:

http://www.makergeeks.com/coabs3dfi10.html

Monday 24 March 2014

Get your PCB Boards made!

The fantastic service from Fritzing - based in Germany. They send worldwide!
http://fab.fritzing.org/fritzing-fab

Picture of PCBs

As you can see, the boards look pretty cool!
Prices seem reasonable too.