An Arduino Project

I2C

0

The other day I connected up my LCD display and BAM, it was dead. I had to order another and when it arrived I found it was not the same. There was this odd board attached to the back of it. Turns out this was a I2C interface. A serial line connection that only needs power and two data lines. This would be awesome if it was easy to get rolling but..

Turns out that it just took some looking at the comments on Amazon, where I bought the display and a web trip to the manufacturers page to get the right address for the serial interface out of the demo app, it was wrong on the product page.

 

The Sketch folder I use.

A PDF of the sketch, project_2014_001

Pictures of the board.

 

 

2014.001 photo 2 2014.001 photo 1 2014.001 photo 3 2014.001 photo 4

 

 

 

 

 

 

 

 

 

 

 

 

 

And finally the sketch, giving descriptions and links as I go.

 

/****************************************
* Use a HC-SR04 ultrasonic sensor and
* Print the measurement to a SainSmart IIC/I2C/TWI
* 1602 Serial LCD Module Display For Arduino
****************************************/
/*

The ultrasonic circuit:
* VCC (+5)
* TRIG pin 9
* ECHO pin 8
* GND (ground)

*/

/*

I2C Connection
*GND (ground)
*VCC (+5)
*SDA A4
*SCL A5
*/

/******************************
include libraries and declare initialize commands before void setup()
******************************/

// include the library code:
#include <Wire.h> //http://arduino.cc/en/reference/wire#.UyhwYflkTh4
//#include <LCD.h> // listed in working example of I2C but not needed here //http://playground.arduino.cc/Code/LCD#.UyhwfvlkTh4
#include <LiquidCrystal_I2C.h>

/*#include <LiquidCrystal.h> //Library for LCD display //https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
*see this for how to use https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
*new LiquidCrystal is not needed but may be faster
*Liquidcrystal library at http://arduino.cc/en/Reference/LiquidCrystal#.UyhwBvlkTh5
*/

#include <NewPing.h> //Library for ultrasonic sensor //https://code.google.com/p/arduino-new-ping/

//Define variables for NewPing.h
#define TRIGGER_PIN 9 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 8 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500 cm.

//some settings for I2C that works with this LCD from http://www.amazon.com/review/R3JN683O0YUPAD/ref=cm_cr_pr_viewpnt#R3JN683O0YUPAD

//define I2C variables for LiquidCrystal_I2C.h
#define I2C_ADDR 0×27 //Address of LCD (Sainsmat shows 0x3f but I found via http://arduino.arigato.cz/I2C_LCD_BackPack_for_1602_and_2004/LCD_16x2_BackPack_v003.ino it was 0×27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

//Initialize LCD
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
// NewPing setup of pins and maximum distance.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); //http://playground.arduino.cc/Code/NewPing

void setup() {

Serial.begin(115200); //setup serial communications for monitoring

// set up the LCD’s number of columns and rows:

lcd.begin (20,4,LCD_5x8DOTS);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.clear();
lcd.print(“CM”);

 

}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):

delay(100); // Wait 100ms between pings (about 10 pings/sec). 29ms should be the shortest delay between pings.

//Send ping, get median (from 5) ping time in microseconds (uS).
unsigned int uS = sonar.ping_median(5); //http://playground.arduino.cc/Code/NewPing#Methods

lcd.clear();// clear LCD for next measurement
lcd.setCursor(0, 0); //cursor to top left
lcd.print(“CM”); // Centimeter label
lcd.setCursor(8, 0); //cursor to top center
lcd.print(“IN”); //Inch label

lcd.setCursor(0, 1); //cursor to bottom left
lcd.print(uS / US_ROUNDTRIP_CM); //Print centimeters
lcd.setCursor(8, 1); //cursor to bottom center
lcd.print((uS / US_ROUNDTRIP_CM)*0.393701); //print Inches

Serial.print(“Ping: “);
Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println(“cm”);

 

}

 

 

Thats Delicious

0

  Coffey Break – Beta 003

Thats Delicious.com

 

Using delicious PDF MOBI

Photo Jun 14, 6 14 09 PM

Acer Aspire V5 Touch

0

The Acer Aspire|V5-571P-6609 came in a small suitcase size box, very compact. The initial start-up required no extra intervention, just providing some login information and a computer name. It lasted about forty minutes and then a bit longer to run updates. At a later date I used a 16gb flash drive to create a recovery stick, in case of emergency. This took about an hour to create.

Here are some pictures of the unboxing.

 

Photo Jun 14, 6 14 15 PMPhoto Jun 14, 6 14 09 PM

 

 

 Photo Jun 14, 6 15 05 PMPhoto Jun 14, 6 15 29 PMPhoto Jun 14, 6 16 21 PM

 Photo Jun 14, 6 18 33 PMPhoto Jun 14, 6 18 50 PM  Photo Jun 14, 6 17 41 PM

 

 

Photo Jun 14, 6 19 33 PMPhoto Jun 14, 6 19 58 PMPhoto Jun 14, 6 21 23 PM (HDR)

 

Photo Jun 14, 6 20 47 PM

    

The lap top has some very nice features.

  • The touch screen
  • Back lighted keyboard
  • 8 gb of ram
  • 1 tb of disk space
  • a dvd rw drive
  • HDMI out
  • VGA/Ethernet dongle
  • Two usb 2 and one usb 3
  • A SD card slot
  • A trial of Microsoft office

I have been using it for about a month and the first issue had was with the wireless network card. When the system went to sleep the network would, intermittently, not wake up. After some internet searching the consensus was the driver. I went to the Acer support page and installed the current wireless driver and all was well. The second problem was of my doing, installing the 8.1 pre update. as a pre update it was somewhat unstable and did not have and Bluetooth support. It took most of a day to put 8.1 on the system and an entire day to recover from the test.

When I began looking over windows 8 on my Dell mini 10v I realized that it could not be useful unless you had a touch screen. The temptation to reach out and touch the tiles of the Metro interface is just to much. If you have any tablet or smart phone you will be hard pressed to not touch any monitor, sometimes. The will not disappoint here. The ten point multitouch screen is very responsive. Allowing you to mix mouse/touch-pad movement with touch in the most helpful way.

The battery life is not as long lasting as I would hope, only two’ish hours watching Hulu. It does have a bright screen that is clear. At 720p it is great for most things but I wold not suggest this system as a major gaming rig.

The audio is better than most but you have to have the system on a hard surface rather that a cushy one for full effect. One drawback is the headphone jack that doubles as a microphone/line in. If you wish to use a headset you will need to get an USB headset.

I find this system to be light and easy to carry. It is quick for the tasks I wish to use it for, web and word processing with some video. The start-up time is very short, less than a minute to the login screen. and wireless connection does not delay you.

If you are looking for a large screen system with plenty of memory and disk space and ample speed for all you light to medium task then this is the one for you.

 

 

 

 

 

 

Cat peeking out of a blanket

Word processing and the student

0

Here is the next Beta version of Coffey Break.

I have embedded the video from YouTube and added the script of the topic below.

 

 


Today lets talk about word processing and what you need to do it.

Word processing is about you creating a document that you need. That might be a short paper, poem, or even a novel. Now I am not going to tell you how or what to write, just some tips to make it easier to get done.

There a many tools for doing this. Some come with your computer, some as free downloads and others must be purchased.

Because our focus is on students I will talk mostly about the free solutions.

A full suite of tools is available at openoffice.org. They provide a download for your system and instructions on installing and using the software. You can also use LibreOffice, an alternate version or fork of openoffice.

You can also use some online versions such as Google Drive or Microsoft skydrive. They have advantages over the installed programs. First they are available to virtually any system via your web browser. The data is stored in the cloud, where you can get to it from any computer with your login and password.

When you start writing that novel make sure that you start with “save as” right away and continue saving every 5 minutes or so.

Nothing is worse than writing for two hours and having the power go out.

While your writing, keep it simple. Don’t format the document until you’re done writing it. This will save you time by not correcting the layout with every big change.

Now for the saving of the final document. When you first saved the doc you will have chosen to use the default file type for you program. Now you must save it out to a format that is able to be read by many programs. I recommend the RTF, rich text format. This format is readable by all word processor programs and carries along the basic formatting you just put into the document.

Some online instructors are asking for the documents to be sent as PDF, portable document format. This is a good “no edit” format. The problem is at the end when the instructor wants all your papers in one pdf document. To do this be sure to keep all the original documents, in the native format. Yes, that means you will have multiple copies of each one.

To get them all into one document you will either import each document one at a time or open the new “all” document and then copy and paste from the others one at a time, saving the final “all” document to a pdf for emailing.

 

An Arduino Project

My sonic II

0

With this version of the previous project, I have added a measurement test. This test is to check on the target being within 5-15 centimeters.


The code is listed below and I tried to add comments to make each step clear. Let me know if it is not, or if you have any other questions.

/****************************************
* use a HC-SR04 ultrasonic sensor and
* print the measurement to a LCD IM161 display
****************************************/

/*

The LCD 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
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)

*/

/*

The ultrasonic circuit:
* VCC (+5)
* TRIG pin 9
* ECHO pin 8
* GND (ground)

*/

/******************************
include libraries and declare initialize
commands before void setup()
******************************/

// include the library code:
//Library for LCD display
//http://arduino.cc/en/Reference/LiquidCrystal
#include //Library for ultrasonic sensor
//https://code.google.com/p/arduino-new-ping/
#include

// Arduino pin tied to trigger pin on the ultrasonic sensor.
#define TRIGGER_PIN 9
// Arduino pin tied to echo pin on the ultrasonic sensor.
#define ECHO_PIN 8
//Maximum distance we want to ping for (in centimeters).
//Maximum sensor distance is rated at 400-500 cm.
#define MAX_DISTANCE 400

// initialize the library with the numbers of the interface pins
//http://arduino.cc/en/Reference/LiquidCrystalConstructor
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// NewPing setup of pins and maximum distance.
//http://playground.arduino.cc/Code/NewPing
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

int led=13; //pin for inrange LED
int okClose=0; //ok not too close 0=too close, 1 = ok
int okFar=0; //ok not too far 0= too far, 1 = ok
int light=0; //light the led 0=off 1=on
int A=0; //centimeters for testing
int toFar=15; // too far away centimeter
int toClose=5; // too close centimeter
int both=0; //final test value 0 or 1 = out of range, 2 = in range

void setup() {

Serial.begin(115200); //setup serial communications for monitoring
pinMode(led,OUTPUT); // setup inrange light

// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
lcd.print(“CM”);

}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):

// Wait 100ms between pings (about 10 pings/sec). 29ms should be the shortest delay between pings.
delay(100);

//Send ping, get median (from 5) ping time in microseconds (uS).
unsigned int uS = sonar.ping_median(5); //http://playground.arduino.cc/Code/NewPing#Methods

// Calculate the CM for testing range
A=(uS / US_ROUNDTRIP_CM);

// test for too close. shows a compact format for the if else statment.
if (A >= toClose)okClose=1; //not too close
else okClose=0; // too close!

//test for too far away. 1 = not too far, 0 = too far away. shows altenate way to format a if else test.
if (A <= toFar)
{okFar=1;}
else
{okFar=0;}

both=0; //clear the ok range test
both=okClose+okFar; // set the ok range test, 0 or 1 is not ok 2 is inrange

light=0; // set led off
if(both==2) light=1;

digitalWrite(led,light); //turn on/off the inrange led

// print labels
lcd.clear();// clear LCD for next measurement
lcd.setCursor(0, 0); //cursor to top left
lcd.print(“CM”); // Centimeter label
lcd.setCursor(8, 0); //cursor to top center
lcd.print(“IN”); //Inch label

// print measurments
lcd.setCursor(4, 0); //cursor to top position 4
lcd.print(uS / US_ROUNDTRIP_CM); //Print centimeters
lcd.setCursor(12, 0); //cursor to top postion 12
lcd.print((uS / US_ROUNDTRIP_CM)*0.393701); //print Inches

// this is diagnostic printing of the led setting process. It can be removed after all is well
lcd.setCursor(0, 1); //cursor to bottom postion 0
lcd.print(okClose); //Print okClose
lcd.setCursor(2,1); //cursor to bottom postion 2
lcd.print(okFar); //print okFar
lcd.setCursor(4,1); //cursor to bottom postion 4
lcd.print(both); //print sum of okClose and okFar
lcd.setCursor(6,1); //cursor to bottom postion 6
lcd.print(light); //print in range indicator

Serial.print(“Ping: “);
// Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.print(uS / US_ROUNDTRIP_CM);
Serial.println(“cm”);

}

Go to Top
Google+