Posts with «lcd» label

Solar Panel System Monitoring Device Using Arduino

[Carl] recently upgraded his home with a solar panel system. This system compliments the electricity he gets from the grid by filling up a battery bank using free (as in beer) energy from the sun. The system came with a basic meter which really only shows the total amount of electricity the panels produce. [Carl] wanted to get more data out of his system. He managed to build his own monitor using an Arduino.

The trick of this build has to do with how the system works. The panel includes an LED light that blinks 1000 times for each kWh of electricity. [Carl] realized that if he could monitor the rate at which the LED is flashing, he could determine approximately how much energy is being generated at any given moment. We’ve seen similar projects in the past.

Like most people new to a technology, [Carl] built his project up by cobbling together other examples he found online. He started off by using a sketch that was originally designed to calculate the speed of a vehicle by measuring the time it took for the vehicle to pass between two points. [Carl] took this code and modified it to use a single photo resistor to detect the LED. He also built a sort of VU meter using several LEDs. The meter would increase and decrease proportionally to the reading on the electrical meter.

[Carl] continued improving on his system over time. He added an LCD panel so he could not only see the exact current measurement, but also the top measurement from the day. He put all of the electronics in a plastic tub and used a ribbon cable to move the LCD panel to a more convenient location. He also had his friend [Andy] clean up the Arduino code to make it easier for others to use as desired.


Filed under: Arduino Hacks

Play your emotional state with Social Vibes and twitter

Social Vibes’ is a Masters Degree (MSc.) project, in Interactive Media by Cian McLysaght, at the University of Limerick, Ireland. They shared with us their project, running on Arduino Uno, composed by a physical artifact designed and created specifically for an installation adopting the fundamental sound mechanisms used in a vibraphone, know also as a ‘Vibe’:

The instrument consists of twelve musical tones of different pitches. The music created on the instrument is derived from a continuous stream of input via multiple users on Twitter and the explicit interaction from Twitter users, tweeting the instrument directly to the project’s, “@vibe_experiment” Twitter account. Data associated with the emotional status of Twitter users, is mined from the Twitter network via Twitter’s open source, application programming interface (API).

For example if a user tweets “The sun is out, I’m happy”, the code I’ve written will strip out key words and strings associated with the user’s emotional state, within the tweets, ie “I’m happy”, and translate this to a musical notation. Mining Twitter’s API, allows a continuous stream of data. These emotional states are then mapped to specific notes on the physical musical instrument, located in a public space. The tempo of the musical expression will be entirely based upon the speed and volume of the incoming tweets on the Twitter API.

Twitter users who are both followers and non followers of the musical instrument’s Twitter account (@vibe_experiment) can tweet directly to the instrument and this direct interaction will be given precedence, allowing user’s who tweet directly to have their emotional state ‘played’. This allows users to hijack or take over the instrument and experiment with it in a playful manner, but also allows those with musical knowledge the potential to compose simple musical arrangements. When users are not tweeting the instrument directly, then the instrument will revert to mining the Twitter API.

To entice users to interact and observe the action of the instrument there is a live streaming broadcast of the instrument via Twitcam on the Vibe’s Twitter account. This is a live streaming broadcast of the instrument via Twitcam on the @vibe_experiment account. Twitcam, is Twitter’s built in live-streaming platform. This simply requires a webcam and a valid Twitter account.

The instrument constantly tweets back updates to it’s own Twitter account to not only inform people of the general status but also to engage users to interact directly with the ‘Vibe’.

Weather Reporter - Temboo, Ethernet and Arduino


 

Arduino is well known for the large variety of sensors / modules that can be connected. It is quite easy to hook up a temperature or humidity sensor to get instant feedback about the surrounding environmental conditions. However, sometimes you do not have a temperature sensor. Sometimes you have a sensor, but would like to know the temperature in other cities ! Or you would like to know what the temperature will be tomorrow?

Well now you can !!

All you need is a Temboo account, an internet connection and the following components:

Parts Required


 
 

Project Description


An Arduino UNO (and Ethernet Shield) queries Yahoo using a Temboo account, and retrieves weather information. The data is filtered and processed, and then passed on to another Arduino UNO to be displayed on a TFT LCD module. Two Arduino UNOs are used because the Ethernet library and the UTFT library are both memory hungry, and together consume more memory than one Arduino UNO can handle. Yes - I could have used a different board such as the Arduino MEGA, but where is the fun in that ?? This project will teach you many things:
  • How to use an Ethernet Shield with a Temboo account to retrieve internet data
  • How to use a TFT LCD module (ITDB02-1.8SP)
  • How to reduce memory consumption when using the UTFT library
  • How to power two Arduinos with a single USB cable
  • How to transmit data from one Arduino to another (via jumper wires)
All of this and a whole lot more !!


 
 

Video

Have a look at the following video to see the project in action.
 




You will need to create a Temboo account to run this project:

Temboo Account Creation

Step 1:

Visit the Temboo website : https://www.temboo.com/ Create an account by entering a valid email address. Then click on the Sign Up button.

 

 

Step 2:

Verify your email address by clicking on the link provided in the email sent by Temboo.

 

Step 3:

You will be directed to the account setup page: Create an Account Name, and Password for future access to your Temboo Account Check the terms of service and if you agree, then tick the box Press the Go! button

 

 

Step 4:

You will then encounter the "Welcome!" screen:

 

 

Step 5:

Navigate to the top right of the screen and select the LIBRARY tab

 

 

Step 6:

On the left hand side you will see a list of choreos. Type Yahoo into the search box on the top left of the screen. Navigate to the GetWeatherByAddress Choreo by clicking on...     Yahoo _ Weather _ GetWeatherByAddress

 

 

Step 7:

Turn the IoT Mode to ON (in the top right of screen)

 

 

Step 8:

What's your platform / device? : Arduino How is it connected? : Arduino Ethernet   The following popup box will appear:

 

 

Step 9:

Name: EthernetShield - you can choose any name. Letters and numbers only. No spaces. Shield Type: Arduino Ethernet MAC Address : You can normally find the MAC address of the Ethernet shield on the underside. Enter the MAC address without the hyphens. Then click SAVE.

 

 

Step 10:

Move to the INPUT section. Enter the Address of the place you want the Temperature for. Address = Perth, Western Australia Expand the Optional INPUT for extra functionality Units = c - If you want the temperature in Celcius.

 

 

Step 11:

This will automatically generate some Arduino CODE and a HEADER FILE. Don't worry about the Arduino code for now... because I will provide that for you. However, you will need the automatically generated HEADER file. I will show you what to do with that soon. So don't lose it !'



Temboo Library Install

The Temboo library will need to be installed before you copy the Arduino code in the sections below. To install the Temboo library into your Arduino IDE, please follow the link to their instructions:   Installing the Temboo Arduino Library

   

UTFT Library Install

Download the UTFT library from this site: http://www.henningkarlsen.com/electronics/library.php?id=51 Once downloaded and extracted. Go into the UTFT folder and look for the memorysaver.h file. Open this file in a text editor, and "uncomment" all of the TFT modules that are not relevant to this project. I disabled all of the TFT modules except the last 3 (which made reference to ST7735) - see picture below. The TFT module we are using in this project is the ITDB02-1.8SP from ITEAD Studio. Save the memorysaver.h file, and then IMPORT the library into the Arduino IDE as per the normal library import procedure.   If you do not modify the memorysaver.h file, the Arduino SLAVE sketch will not compile.

   

Arduino Code (MASTER)

  This project uses 2 Arduino UNOs. One will be the Master, and one will be the Slave. The following code is for the Arduino MASTER.   Open up the Arduino IDE. (I am using Arduino IDE version 1.6) Paste the following code into the Arduino IDE code window.   PLEASE NOTE: You may need to change some of the lines to accomodate your INPUTS from step 10. Have a look around line 36 and 37.  
  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187


/* ===============================================================================
      Project: Weather Reporter: Temboo, Ethernet, Arduino
        Title: ARDUINO MASTER: Get temperature from Yahoo using Temboo
       Author: Scott C
      Created: 27th February 2015
  Arduino IDE: 1.6.0
      Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html
  Description: The following sketch was designed for the Arduino MASTER device. 
               It will retrieve temperature/weather information from Yahoo using your
               Temboo account (https://www.temboo.com/), which will then be sent to the
               Arduino Slave device to be displayed on a TFT LCD module.
               
   Libraries : Ethernet Library (that comes with Arduino IDE)
               Temboo Arduino Library - https://www.temboo.com/sdk/arduino
               
   Temboo Library installation instructions for Arduino: 
               https://www.temboo.com/arduino/others/library-installation

  You will also need to copy your Temboo Account information into a new tab and call it TembooAccount.h.
  Please follow the instructions on the ArduinoBasics blog for more information.
---------------------------------------------------------------------------------- */

#include <SPI.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information - in a new tab.
#include <Wire.h>

byte ethernetMACAddress[] = ETHERNET_SHIELD_MAC; //ETHERNET_SHIELD_MAC variable located in TembooAccount.h
EthernetClient client;

String Address = "Perth, Western Australia"; // Find temperature for Perth, Western Australia
String Units = "c"; // Display the temperature in degrees Celcius

String ForeCastDay[7]; //String Array to hold the day of the week
String ForeCastTemp[7]; //String Array to hold the temperature for that day of week.

int counter1=0; //Counters used in FOR-LOOPS.
int counter2=0;

boolean downloadTemp = true; // A boolean variable which controls when to query Yahoo for Temperature information.



void setup() {
  Wire.begin(); // join i2c bus : Used to communicate to the Arduino SLAVE device.
 
  // Ethernet shield must initialise properly to continue with sketch.
  if (Ethernet.begin(ethernetMACAddress) == 0) {
    while(true);
  }
  
  //Provide some time to get both Arduino's ready for Temperature Query.
    delay(2000);
}




void loop() {
  if (downloadTemp) {
    downloadTemp=false; //Stop Arduino from Querying Temboo repeatedly
    getTemperature();       //Retrieve Temperature data from Yahoo
    transmitResults();      //Transmit the temperature results to the Slave Arduino
  }
}




/* This function will Query Yahoo for Temperature information (using a Temboo account) */

void getTemperature(){
    TembooChoreo GetWeatherByAddressChoreo(client);

    // Invoke the Temboo client
    GetWeatherByAddressChoreo.begin();

    // Set Temboo account credentials
    GetWeatherByAddressChoreo.setAccountName(TEMBOO_ACCOUNT); //TEMBOO_ACCOUNT variable can be found in TembooAccount.h file or tab
    GetWeatherByAddressChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); //TEMBOO_APP_KEY_NAME variable can be found in TembooAccount.h file or tab
    GetWeatherByAddressChoreo.setAppKey(TEMBOO_APP_KEY); //TEMBOO_APP_KEY variable can be found in TembooAccount.h file or tab

    // Set Choreo inputs
    GetWeatherByAddressChoreo.addInput("Units", Units); // Set the Units to Celcius
    GetWeatherByAddressChoreo.addInput("Address", Address); // Set the Weather Location to Perth, Western Australia

    // Identify the Choreo to run
    GetWeatherByAddressChoreo.setChoreo("/Library/Yahoo/Weather/GetWeatherByAddress");

    // This output filter will extract the expected temperature for today
    GetWeatherByAddressChoreo.addOutputFilter("Temperature", "/rss/channel/item/yweather:condition/@temp", "Response");
    
    // These output filters will extract the forecasted temperatures (we need to know the day and temperature for that day)
    GetWeatherByAddressChoreo.addOutputFilter("ForeCastDay", "/rss/channel/item/yweather:forecast/@day", "Response");
    GetWeatherByAddressChoreo.addOutputFilter("ForeCastHigh", "/rss/channel/item/yweather:forecast/@high", "Response");

    // Run the Choreo;
    GetWeatherByAddressChoreo.run();

    //Reset our counters before proceeding
    counter1 = 0;
    counter2 = 0;
    
    while(GetWeatherByAddressChoreo.available()) {
      // This will get the first part of the output
      String name = GetWeatherByAddressChoreo.readStringUntil('\x1F');
      name.trim(); // get rid of newlines

      // This will get the second part of the output
      String data = GetWeatherByAddressChoreo.readStringUntil('\x1E');
      data.trim(); // get rid of newlines

      //Fill the String Arrays with the Temperature/Weather data
      if (name == "Temperature") {
        ForeCastDay[counter1] = "Today";
        ForeCastTemp[counter2] = data;
        counter1++;
        counter2++;
      }
      
      if(name=="ForeCastDay"){
        ForeCastDay[counter1] = data;
        counter1++;
      }
      
      if(name=="ForeCastHigh"){
        ForeCastTemp[counter2] = data;
        counter2++;
      }
    }
  
    //Close the connection to Temboo website
    GetWeatherByAddressChoreo.close();
  }
  
  
  
  
  /* This function is used to transmit the temperature data to the Slave Arduino */
  
  void transmitResults(){
    char tempData[10];
    int tempStringLength = 0;
    
    //Modify the current temp to "Now"
    ForeCastDay[0] = "Now";
    
    //Send * to Slave Arduino to prepare for Temperature Transmission
    Wire.beginTransmission(4); // Transmit to device #4 (Slave Arduino)
    Wire.write("*");
    delay(500);
    Wire.endTransmission();
    delay(500);
    
    //Send the temperatures on the Slave Arduino to be displayed on the TFT module.
    for (int j=0; j<20; j++){
      for (int i=0; i<6; i++){
        memset(tempData,0,sizeof(tempData));   //Clear the character array
        String tempString = String(ForeCastDay[i] + "," + ForeCastTemp[i] + ".");
        tempStringLength = tempString.length();
        tempString.toCharArray(tempData, tempStringLength+1);
        Wire.beginTransmission(4); // Transmit to device #4 (Slave Arduino)
        Wire.write(tempData);
        delay(1000);
        Wire.endTransmission();
        delay(4000);
      }
    }
    
    /* ----------------------------------------------------------------------
    // You can use this to send temperature results to the Serial Monitor.
    // However, you will need a Serial.begin(9600); statement in setup().
    
    Serial.println("The Current Temperature is " + ForeCastTemp[5] + " C");
    Serial.println();
    Serial.println("The Expected Temperature for");
    for (int i=0; i<5; i++){
      Serial.println(ForeCastDay[i] + " : " + ForeCastTemp[i] + " C");
    }
    ---------------------------------------------------------- */
  }
  

 
 
 
Select "New Tab" from the drop-down menu on the top right of the IDE. Name the file: TembooAccount.h

Paste the contents of the HEADER file from the Temboo webpage (Step 11 above) into the TembooAccount.h tab. If you do not have the TembooAccount.h tab with the contents of this HEADER file next to your Arduino Master sketch, then it will NOT work.  
Make sure to SAVE the Arduino Sketch and upload the code to the Arduino (MASTER)

   

Arduino Code (SLAVE)

  This project uses 2 Arduino UNOs. One will be the Master, and one will be the Slave. The following code is for the Arduino SLAVE.   Make sure to disconnect the Arduino MASTER from your computer, and keep it to one side. Connect the Arduino SLAVE to your computer, and upload the following code to it. Make sure to create a new sketch for this code (File _ New).  
  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197


/* ===============================================================================
      Project: Weather Reporter: Temboo, Ethernet, Arduino
        Title: ARDUINO SLAVE: Display temperature on TFT LCD Module
       Author: Scott C
      Created: 27th February 2015
  Arduino IDE: 1.6.0
      Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html
  Description: The following sketch was designed for the Arduino SLAVE device. 
               It will receive temperature information from the Arduino MASTER
               and then display this information on the ITDB02-1.8SP TFT LCD 
               Module. Please read the important notes below.

----------------------------------------------------------------------------------
NOTES:
This sketch makes use of the UTFT.h library from : 
http://www.henningkarlsen.com/electronics/library.php?id=51
Please note: You will need to modify the memorysaver.h file in the UTFT folder 
with a text editor to disable any unused TFT modules. This will save memory, 
and allow you to run this sketch on an Arduino UNO. I disabled all TFT modules in
that file except the last 3 (which made reference to ST7735).
I used a ITDB02-1.8SP TFT LCD Module from ITEAD Studio.
PinOut:

Arduino SLAVE      ITDB02-1.8SP TFT
         3.3V ---- VDD33
 Digital9 (D9)---- CS
 Digital8 (D8)---- SCL
 Digital7 (D7)---- SDA
 Digital6 (D6)---- RS
 Digital5 (D5)---- RST
          GND ---- GND
           5V ---- VIN

Usage: UTFT myGLCD(<model code>, SDA, SCL, CS, RST, RS);
Example: UTFT myGLCD(ITDB18SP,7,8,9,5,6);

-----------------------------------------------------------------------------------
This sketch also makes use of the Wire.h library. 
The Wire.h library comes with the Arduino IDE.
This enables communication between Arduino Master and Arduino Slave.
PinOut:

Arduino MASTER      Arduino SLAVE
   Analog4(A4) ---- Analog4 (A4) 
   Analog5(A5) ---- Analog5 (A5) 
           GND ---- GND

-----------------------------------------------------------------------------------
The Arduino Slave is powered by the Arduino Master:
PinOut:

Arduino MASTER      Arduino SLAVE
            5V ---- VIN

==================================================================================
*/

#include <UTFT.h>
#include <Wire.h>

//Declare all of the fonts
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Usage: UTFT myGLCD(<model code>, SDA, SCL, CS, RST, RS);
UTFT myGLCD(ITDB18SP,7,8,9,5,6);

boolean tempDisplay = false; //Helps with processing the data from the Arduino MASTER
boolean readTemp = false; //Helps to differentiate the day from the temperature values
String dayOfWeek=""; //Variable used to hold the Day of the Week
String tempReading=""; //Variable used to hold the Temperature for that day

String Units = "'C "; //Display Temperature in Celcius
String Address = "Perth, WA"; //Address to show at top of Display


void setup(){
  // Initialise the TFT LCD
  myGLCD.InitLCD();
  initialiseLCD();
  delay(5000);
  
  //Setup the Serial communication between the Arduino MASTER and SLAVE
  Wire.begin(4); // join i2c bus with address #4
  Wire.onReceive(receiveEvent); // register event
}



void loop(){
  delay(50);
}


/*
  This function initialises the TFT LCD, and draws the initial screen.
*/
void initialiseLCD(){
  //Clear the screen
  myGLCD.clrScr();
  
  //Draw the borders (top and bottom)
  myGLCD.setColor(25, 35, 4);
  myGLCD.fillRect(0, 0, 159, 13);
  myGLCD.fillRect(0, 114, 159, 127);
  myGLCD.drawLine(0,18,159,18);
  myGLCD.drawLine(0,109,159,109);
  
  //Header and Footer Writing
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(25, 35, 4);
  myGLCD.setFont(SmallFont);
  myGLCD.print("arduinobasics", CENTER, 1);
  myGLCD.print("blogspot.com", CENTER, 114);
}




/* This function executes whenever data is received from Arduino master
   It will ignore all data from the Master until it receives a '*' character.
   Once this character is received, it will call the receiveTemp() function
   in order to receive Temperature data from the Arduino Master.
*/
void receiveEvent(int howMany){
  if(tempDisplay){
    receiveTemp();
  }else{
    while(0 < Wire.available()){
      char c = Wire.read(); // receive byte as a character
      if(c=='*'){ // Searching for a '*' character
        tempDisplay=true; // If '*' received, then call receiveTemp() function
      }
    }
  }
}



/* This function is used to receive and process the Temperature data 
   from the Arduino Master and pass it on to the  displayTemp() funtion.
*/
void receiveTemp(){
  tempReading="";
  dayOfWeek = "";
  
  while(0 < Wire.available()){
    char c = Wire.read(); // receive byte as a character
    if(readTemp){
      if(c=='.'){ // If a . is detected. It is the end of the line.
        readTemp=false;
      }else{
        tempReading=tempReading+c;
      }
    }else{
      if(c==','){
      } else {
        dayOfWeek=dayOfWeek+c;
      }
    }
    if(c==','){
      readTemp=true;
    }
  }
  displayTemp();
}



/*
  Display the Temperature readings on the TFT LCD screen.
*/
void displayTemp(){
  //Clear the writing on top and bottom of screen
  myGLCD.setColor(25, 35, 4);
  myGLCD.fillRect(0, 0, 159, 13);
  myGLCD.fillRect(0, 114, 159, 127);
  
  //Small writing on top and bottom of screen
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(25, 35, 4);
  myGLCD.setFont(SmallFont);
  myGLCD.print(Address, CENTER, 1);
  myGLCD.print(dayOfWeek, CENTER, 114);
  
  //Write the big temperature reading in middle of screen
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.print(tempReading, CENTER, 40);
  
  //Write the Units next to the temperature reading
  myGLCD.setFont(BigFont);
  myGLCD.print(Units, RIGHT, 40);
}

 
 
 

Wiring it up

Once the code has been uploaded to both Arduinos (Master and Slave), I tend to label each Arduino so that I don't mix them up. You will notice an 'S' marked on the SLAVE in some of the photos/videos. Then it is time to piggy-back the shields onto the Arduinos and wire them up. Make sure you disconnect the USB cable from the Arduinos before you start doing this.

 

Step 1: Ethernet Shield

Place the Ethernet shield onto the Arduino MASTER. Connect an Ethernet cable (RJ45) to the Ethernet shield. The other end will connect to your internet router.

 
 

Step 2: Arduino SLAVE and TFT LCD module

 
You can either wire up the TFT LCD module on a breadboard, or you can use a ProtoShield with mini-breadboard. It doesn't really matter how you hook it up, but make sure you double check the connections and the TFT specifications before you power it up. I have powered the Arduino Slave by connecting it to the Arduino Master (see fritzing sketch below).  
There is no reason why you couldn't just power the slave seperately. In fact this is probably the safer option. But I read that this power-sharing setup was ok, so I wanted to give it a go. I have no idea whether it would be suitable for a long term power project... so use it at your own risk. I tried using 4 x AA batteries to power this circuit, but found that the LCD screen would flicker. So then I tried a 9V battery, and noticed that the 5V voltage regulator was heating up more than I felt comfortable with. In the end, I settled with the USB option, and had no further issues. I am sure there are other possible options, and feel free to mention them in the comments below.  
Use the following fritzing sketch and tables to help you wire this circuit up.

 

Fritzing sketch

 

 
 

 

Arduino MASTER to SLAVE connection table

 

 
 

 

Arduino SLAVE to ITDB02-1.8SP TFT LCD

 

 
 

ITDB02-1.8SP TFT LCD Module Pictures

 

 

 
 

Project Pictures

 

 

 

 



If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 



However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.

Making a Player Piano Talk MIDI

[Ramon] was always fascinated with pianos, and when he came across a few player piano rolls in an antique shop, a small kernel of a project idea was formed. He wondered if anyone had ever tried to convert a player piano into a full MIDI instrument, with a computer tickling the ivories with a few commands. This led to one of the best builds we’ve ever seen: a player piano connected to a computer.

[Ramon] found an old piano in Craigslist for a few hundred dollars, and once it made its way into the workshop the teardown began. Player pianos work via a vacuum, where air is sucked through a few pin points in a piano roll with a bellows. A series of pipes leading to each key translate these small holes into notes. Replicating this system for a MIDI device would be impossible, but there are a few companies that make electronic adapters for player pianos. All [Ramon] would have to do is replicate that.

The lead pipes were torn out and replaced with 88 separate solenoid valves. These valves are controlled via a shift register, and the shift registers controlled by an ATMega. There’s an astonishing amount of electronic and mechanical work invested in this build, and the finished product shows that.

As if turning an ancient player piano into something that can understand and play MIDI music wasn’t enough, [Ramon] decided to add a few visuals to the mix. He found a display with a ratio of 16:4.5 – yes, half as tall as 16:9 – and turned the front of the piano into a giant display. The ten different styles of visualization were whipped up in Processing.

The piano has so far been shown at an interactive art exhibit in Oakland, and hopefully it’ll make it to one of the Maker Faires next year. There are also plans to have this piano output MIDI with a key scanner underneath all the keys. Very impressive work.

Video below.


Filed under: musical hacks
Hack a Day 26 Dec 00:00

Programmable Lithium Charger Shield for Arduino

Surely you need yet another way to charge your lithium batteries—perhaps you can sate your desperation with this programmable multi (or single) cell lithium charger shield for the Arduino<! Okay, so you’re not><em>hurting</em> for another method of juicing up your batteries. If you’re a regular around these parts of the interwebs, you’ll recall the <a href="http://hackaday.com/2014/09/21/a-li-ion-battery-charging-guide/">lithium charging guide</a> and that <a href="http://hackaday.com/2014/09/05/an-obsessively-thorough-battery-and-more-showdown/">rather incredible, near-encyclopedic rundown of both batteries and chargers</a>, which likely kept your charging needs under control.</p> <p>That said, this shield by Electro-Labs might be the perfect transition for the die-hard-’duino fanatic looking to migrate to tougher projects. The build features an LCD and four-button interface to fiddle with settings, and is based around an LT1510 constant current/constant voltage charger IC. You can find the schematic, bill of materials, code, and PCB design on the Electro-Labs webpage, as well as a brief rundown explaining how the circuit works. Still want to add on the design? Throw in <a href="http://hackaday.com/2014/07/16/finally-an-easy-to-make-holder-for-lithium-ion-batteries/">one of these Li-ion holders</a> for quick battery swapping action.</p> <p>[via <a href="http://embedded-lab.com/blog/?p=9644">Embedded Lab</a>]</p><br />Filed under: <a href="http://hackaday.com/category/arduino-hacks/">Arduino Hacks</a>, <a href="http://hackaday.com/category/microcontrollers/">Microcontrollers</a> <a><img src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/138748/" /></a> <img src="http://pixel.wp.com/b.gif?host=hackaday.com&blog=4779443&post=138748&subd=hackadaycom&ref=&feed=1" />

New Brain for an Old Washing Machine

When the washing machine at [hydronucleus]‘s place went on the fritz, he went straight to the toolbox to try to repair it. The problem was with the old mechanical control unit, so [hydronucleus] got an Arduino out of the parts bin to create a brand new electronic controller for his washing machine. (Imgur Link)

The old mechanical controller functioned like a player piano. A rotating drum with ridges actuate different cycles in the washing machine. Some of the cycles weren’t working properly so [hydronucleus] ripped them out. With the help of a schematic posted on the washing machine itself, the cycles were able to be programmed into the Arduino.

The other obstacle in this repair was getting enough relays together to switch everything in the washing machine. This was solved with a Sainsmart 16 relay block, which has more than enough relays for the job. [hydronucleus] wired up an LCD and a pushbutton to control it and his washing machine is as good as new! The cost of the repair certainly beats a new machine, too. Although if it finally gives up the ghost completely, he could always turn it into a windmill.

Want to read more about [hydronucleus]‘s washing machine hack? Check out his Reddit thread!


Filed under: home hacks

Tutorial – PCF8574 backpacks for LCD modules and Arduino

Learn how to use inexpensive serial backpacks with character LCD modules with your Arduino. This is chapter fifty-eight of our huge Arduino tutorial series.

Introduction

Using LCD modules with your Arduino is popular, however the amount of wiring requires time and patience to wire it up correctly – and also uses a lot of digital output pins. That’s why we love these serial backpack modules – they’re fitted to the back of your LCD module and allows connection to your Arduino (or other development board) with only four wires – power, GND, data and clock.

You can use this with LCD modules that have a HD44780-compatible interface with various screen sizes. For example a 16 x 2 module:

The backpack can also be used with 20 x 4 LCDs. The key is that your LCD must have the interface pads in a single row of sixteen, so it matches the pins on the backpack – for example:

Hardware Setup

Now let’s get started. First you need to solder the backpack to your LCD module. While your soldering iron is warming up, check that the backpack pins are straight and fit in the LCD module, for example:

Then solder in the first pin, while keeping the backpack flush with the LCD:

If it’s a bit crooked, you can reheat the solder and straighten it up again. Once you’re satisfied with the alignment, solder in the rest of the pins:

Now to keep things neat, trim off the excess header pins:

Once you’ve finished trimming the header pins, get four male to female jumper wires and connect the LCD module to your Arduino as shown in the following image and table. Then connect your Arduino to the computer via USB:

Software Setup

The next step is to download and install the Arduino I2C LCD library for use with the backpack. First of all, rename the “LiquidCrystal” library folder in your Arduino libraries folder. We do this just to keep it as a backup.

If you’re not sure where your library folder can be found – it’s usually in your sketchbook folder, whose location can usually be found in the Arduino IDE preferences menu:

Next, visit https://bitbucket.org/fmalpartida/new-liquidcrysta… and download the latest file, currently we’re using v1.2.1. Expanding the downloaded .zip file will reveal a new “LiquidCrystal” folder – copy this into your Arduino libraries folder.

Now restart the Arduino IDE if it was already running – or open it now. To test the module we have a demonstration sketch prepared, simply copy and upload the following sketch:

/* Demonstration sketch for PCF8574T I2C LCD Backpack 
Uses library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads GNU General Public License, version 3 (GPL-3.0) */
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C	lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack

void setup()
{
  // activate LCD module
  lcd.begin (16,2); // for 16 x 2 LCD module
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
}

void loop()
{
  lcd.home (); // set cursor to 0,0
  lcd.print(" tronixlabs.com"); 
  lcd.setCursor (0,1);        // go to start of 2nd line
  lcd.print(millis());
  delay(1000);
  lcd.setBacklight(LOW);      // Backlight off
  delay(250);
  lcd.setBacklight(HIGH);     // Backlight on
  delay(1000);
}

After a few moments the LCD will be initialised and start to display our URL and the value for millis, then blink the backlight off and on – for example:

If the text isn’t clear, or you just see white blocks – try adjusting the contrast using the potentiometer on the back of the module.

How to control the backpack in your sketch

As opposed to using the LCD module without the backpack, there’s a few extra lines of code to include in your sketches. To review these, open the example sketch mentioned earlier.

You will need the libraries as shown in lines 3, 4 and 5 – and initialise the module as shown in line 7. Note that the default I2C bus address is 0x27 – and the first parameter in the LiquidCrystal_I2C function.

Finally the three lines used in void setup() are also required to initialise the LCD. If you’re using a 20×4 LCD module, change the parameters in the lcd.begin() function.

From this point you can use all the standard LiquidCrystal functions such as lcd.setCursor() to move the cursor and lcd.write() to display text or variables as normal. The backlight can also be turned on and off with lcd.setBacklight(HIGH) or lcd.setBacklight(LOW).

You can permanently turn off the backlight by removing the physical jumper on the back of the module.

Changing the I2C bus address

If you want to use more than one module, or have another device on the I2C bus with address 0x27 then you’ll need to change the address used on the module. There are eight options to choose from, and these are selected by soldering over one or more of the following spots:

There are eight possible combinations, and these are described in Table 4 of the PCF8574 data sheet which can be downloaded from the NXP website. If you’re unsure about the bus address used by the module, simply connect it to your Arduino as described earlier and run the I2C scanner sketch from the Arduino playground.

We hope you enjoyed this tutorial and you can make use of it. Finally, if you enjoyed this tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a fourth printing!) “Arduino Workshop”.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our forum – dedicated to the projects and related items on this website.
Tronixstuff 24 Sep 12:57

Tutorial – PCF8574 backpacks for LCD modules and Arduino

Learn how to use inexpensive serial backpacks with character LCD modules with your Arduino. This is chapter fifty-eight of our huge Arduino tutorial series.

Introduction

Using LCD modules with your Arduino is popular, however the amount of wiring requires time and patience to wire it up correctly – and also uses a lot of digital output pins. That’s why we love these serial backpack modules – they’re fitted to the back of your LCD module and allows connection to your Arduino (or other development board) with only four wires – power, GND, data and clock.

You can use this with LCD modules that have a HD44780-compatible interface with various screen sizes. For example a 16 x 2 module:

The backpack can also be used with 20 x 4 LCDs. The key is that your LCD must have the interface pads in a single row of sixteen, so it matches the pins on the backpack – for example:

Hardware Setup

Now let’s get started. First you need to solder the backpack to your LCD module. While your soldering iron is warming up, check that the backpack pins are straight and fit in the LCD module, for example:

Then solder in the first pin, while keeping the backpack flush with the LCD:

If it’s a bit crooked, you can reheat the solder and straighten it up again. Once you’re satisfied with the alignment, solder in the rest of the pins:

Now to keep things neat, trim off the excess header pins:

Once you’ve finished trimming the header pins, get four male to female jumper wires and connect the LCD module to your Arduino as shown in the following image and table. Then connect your Arduino to the computer via USB:

Software Setup

The next step is to download and install the Arduino I2C LCD library for use with the backpack. First of all, rename the “LiquidCrystal” library folder in your Arduino libraries folder. We do this just to keep it as a backup.

If you’re not sure where your library folder can be found – it’s usually in your sketchbook folder, whose location can usually be found in the Arduino IDE preferences menu:

Next, visit https://bitbucket.org/fmalpartida/new-liquidcrysta… and download the latest file, currently we’re using v1.2.1. Expanding the downloaded .zip file will reveal a new “LiquidCrystal” folder – copy this into your Arduino libraries folder.

Now restart the Arduino IDE if it was already running – or open it now. To test the module we have a demonstration sketch prepared, simply copy and upload the following sketch:

/* Demonstration sketch for PCF8574T I2C LCD Backpack 
Uses library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads GNU General Public License, version 3 (GPL-3.0) */
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C	lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack

void setup()
{
  // activate LCD module
  lcd.begin (16,2); // for 16 x 2 LCD module
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
}

void loop()
{
  lcd.home (); // set cursor to 0,0
  lcd.print(" tronixlabs.com"); 
  lcd.setCursor (0,1);        // go to start of 2nd line
  lcd.print(millis());
  delay(1000);
  lcd.setBacklight(LOW);      // Backlight off
  delay(250);
  lcd.setBacklight(HIGH);     // Backlight on
  delay(1000);
}

After a few moments the LCD will be initialised and start to display our URL and the value for millis, then blink the backlight off and on – for example:

If the text isn’t clear, or you just see white blocks – try adjusting the contrast using the potentiometer on the back of the module.

How to control the backpack in your sketch

As opposed to using the LCD module without the backpack, there’s a few extra lines of code to include in your sketches. To review these, open the example sketch mentioned earlier.

You will need the libraries as shown in lines 3, 4 and 5 – and initialise the module as shown in line 7. Note that the default I2C bus address is 0x27 – and the first parameter in the LiquidCrystal_I2C function.

Finally the three lines used in void setup() are also required to initialise the LCD. If you’re using a 20×4 LCD module, change the parameters in the lcd.begin() function.

From this point you can use all the standard LiquidCrystal functions such as lcd.setCursor() to move the cursor and lcd.write() to display text or variables as normal. The backlight can also be turned on and off with lcd.setBacklight(HIGH) or lcd.setBacklight(LOW).

You can permanently turn off the backlight by removing the physical jumper on the back of the module.

Changing the I2C bus address

If you want to use more than one module, or have another device on the I2C bus with address 0x27 then you’ll need to change the address used on the module. There are eight options to choose from, and these are selected by soldering over one or more of the following spots:

There are eight possible combinations, and these are described in Table 4 of the PCF8574 data sheet which can be downloaded from the NXP website. If you’re unsure about the bus address used by the module, simply connect it to your Arduino as described earlier and run the I2C scanner sketch from the Arduino playground.

We hope you enjoyed this tutorial and you can make use of it. Finally, if you enjoyed this tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a fourth printing!) “Arduino Workshop”.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our forum – dedicated to the projects and related items on this website.

The post Tutorial – PCF8574 backpacks for LCD modules and Arduino appeared first on tronixstuff.

Tronixstuff 24 Sep 12:57

End Table Kegerator Hides the Tap when You’re Not Looking

What’s better than an ordinary end table? How about an end table that can serve you beer? [Sam] had this exact idea and used his skills to make it a reality. The first step of the build was to acquire an end table that was big enough to hold all of the components for a functional kegerator. This proved to be a bit tricky, but [Sam] got lucky and scored a proper end table from a garage sale for only $5.00.

Next, [Sam] used bathroom sealant to seal up all of the cracks in the end table. This step is important to keep the inside cold. Good insulation will keep the beer colder, while using less electricity. Next, a hole was cut into the top of the table for the draft tower.

The draft tower is mounted to a couple of drawer slides. This allows the tower to raise up and down, keeping it out of sight when you don’t want it. The tower raises and lowers using a simple pulley system. A thin, high strength rope is attached to the tower. The other end is attached to a spool and a small motor. The motor can wind or unwind the spool in order to raise and lower the tower.

The table houses an Arduino, which controls the motor via a homemade H bridge. The Arduino is hooked up to a temperature sensor and a small LCD screen. This way, the users can see how cold their beer will be before they drink it.

To actually keep the beer cold, [Sam] ripped apart a mini fridge. He moved the compressor and condenser coils to the new table. He had to bend the coils to fit, taking care not to kink them. Finally he threw in the small keg, co2 tank and regulator. The final product is a livingroom gem that provides beer on demand.

Demo video (which is going the wrong way) can be found after the break.


Filed under: Arduino Hacks, Beer Hacks

TFT LCDs Hit Warp Speed with Teensy 3.1

[Paul Stoffregen], known as father of the Teensy, has leveraged the Teensy 3.1’s hardware to obtain some serious speed gains with SPI driven TFT LCDs. Low cost serial TFT LCDs have become commonplace these days. Many of us have used Adafruit’s TFT LCD library  to drive these displays on an Arduino. The Adafruit library gives us a simple API to work with these LCDs, and saves us from having to learn the intricacies of various driver chips.

[Paul] has turbocharged the library by using hardware available on Teensy 3.1’s 32 Freescale Kinetis K20 microcontroller. The first bump is raw speed. The Arduino’s ATmega328 can drive the SPI bus at 8MHz, while the Teensy’s Kinetis can ramp things up to 24MHz.

Speed isn’t everything though. [Paul] also used the Freescale’s 4 level FIFO to buffer transfers. By using a “Write first, then block until the FIFO isn’t full” algorithm, [Paul] ensured that new data always gets to the LCD as fast as possible.

Another huge bump was SPI chip select. The Kinetis can drive up to 5 SPI chip select pins from hardware. The ATmega328 doesn’t support chip selects. so they must be implemented with GPIO pins, which takes even more time.

The final result is rather impressive. Click past the break to see the ATmega based Arduno race against the Kinetis K20 powered Teensy 3.1.

Paul’s library is open source and available on Github.


Filed under: Microcontrollers
Hack a Day 18 Aug 18:00
arduino  lcd  microcontrollers  paul  pjrc  spi  teensy  teensy 3.1  tft