Connect 1.8″ TFT SPI to Arduino UNO

Test TFT connected to Arduino with the text “Scidle.com”
 If you are thinking of doing a project with Arduino UNO and need to view data without having to show them through a serial or USB port on your computer, you’ll need a small screen or display. Let’s see how to use a TFT 1.8″ by SPI. It is not designed for use with an Arduino UNO so its I/O ports do not work 3.3V but 5V. What it allows is powered at 5V, in fact if we feed it to 3.3V for use with an Arduino Nano or 3V Trinket have to short the JP1 connection to not use the voltage regulator that powers both the TFT as the SD card. In this case we will not use the SD ,
Back of the TFT
Back of the TFT
Pins of TFT:
  • Alimentation(VCC, GND): By default must be connected to 5V, but if we short-circuit JP1 we have to feed 3.3V.
  • TFT – I/O (RESET, AO, SDA, SCK, CS): Work at logic levels from 3.3V to 0V.
  • Tarjeta SD – I/O(SCK, MISO, MOSI, CS):  Work at logic levels from 3.3V to 0V.
  • Backlighting (LED+, LED-): We connect to 3.3V (LED +) and 0V (LED-), but this way we can not control the intensity. A good way would be to use a circuit with a transistor controlled by PWM, so that by varying the duty cycle give the feeling of a variation in the intensity of light, when you are actually turning off and on several times per second, according to frequency we choose.
Pins of TFT
Pins of TFT

To connect to the TFT to an Arduino UNO have to change the levels 5V to 3.3V with 74HC245.

Before connecting, we must see settings that we have to use on 74HC245. Keep in mind that port An is 3.3V and port Bn 5V. In addition the master SPI is Arduino UNO so Bn must be An input so output being  A=B. To operate in this way the settings are /OE=L DIR=L.

74HC245 Configuration Table.

The connection with Arduino UNO  is the following (Click on image to higher resolution).

Connection between 74HC245 Arduino UNO and TFT

When everything is connected as in the scheme, we load our first test in Arduino UNO, We will need to have installed the Adafruit_GFX and Adafruit_ST7735 libraries. A sample code to start can be this:

#include <Adafruit_GFX.h>    
#include <Adafruit_ST7735.h>
#include <SPI.h>

#define TFT_CS     10
#define TFT_RST    9  
#define TFT_DC     8
#define TFT_SCLK 13
#define TFT_MOSI 11

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
void setup(void) {
  tft.initR(INITR_BLACKTAB);
}

void loop() {
  delay(500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_RED);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_MAGENTA);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_YELLOW);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_GREEN);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_BLUE);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_CYAN);
  tft.println("Scidle.com");
  delay(1500); 
}

[+]

Google TTS on Ubuntu

If you‘ve ever wanted to install a TTS (Text to Speech) and have not known how, I propose a simple way to use Google TTS on Linux. The most common is to install an addon on your browser, but have the limitation of not being able to use it in a PDF or a text file. This way you can use it regardless of which program you are using just highlighting the text you want to hear and pressing a key combination of your choice.

 First we will install the say.sh script, you can download it from here or make a clone with git. Before you create a folder for our script in our home.
mkdir script
cd scripts
git clone https://gist.github.com/873364.git

[+]

Install GitHub libraries on Arduino IDE

GitHub
GitHub

If you’ve ever been looking for Arduino libraries sure you finished in GitHub. This web repository has thousands of libraries that can be very useful for our projects with Arduino. Let’s see a couple of ways to install a library that is hosted on GitHub. For this example I chose the aJson library.
In the first place we will see how a manual installation would be done, for which we need to download the library in a ZIP clicking the Download ZIP button inside the project page.

library download ZIP file button of GitHub.
library download ZIP file button of GitHub.

Once downloaded if we try to add the library using the drop-down menu Import Sketch >> Library   >> Add Library   It will give an error because Arduino IDE supports only ASCII characters in file names of libraries and Github added  a - master at the end of the name, both ZIP and the project folder. The problem is that the ‘-‘ character not supported . Therefore we have to extract the ZIP by hand in the libraries folder of your sketchbook (in Ubuntu is in the user home, in ~/sketchbook/libraries/). Once extracted we need to rename the folder by removing all non-ASCII characters, in most cases just remove the -master” final and it will be ready to use. When we return to open Arduino IDE and library will be available in our sketchbook.

Another way to install the library is by git. If you have not yet installed what you can do it using the Ubuntu Software Center or using the following command Instruction:

sudo apt-get install git
URL para hacer clone de un proyecto en git.
URL to clone a GitHub project.

If you already have git, to install the library just open a terminal, go to ~/sketchbook/libraries/ folder and make a clone of the URL of the project, you can find just above the  download ZIP button.

cd ~/sketchbook/libraries/ 
git clone https://github.com/interactive-matter/aJson.git

[+]

Install Arduino IDE in Ubuntu

Arduino

The easiest and popular way to introducing us to the world of microcontrollers is using Arduino. The great advantage over other development platforms is its simplicity and above all the support you have from your community. The fact that it is an open-source project opens up endless possibilities for customization, as you have access to all design, from electronics to software.

arduino_uno
Arduino UNO
 But Arduino is not only a hardware also need a simple and friendly environment programming for everyone, including those who have never programmed. That environment is Arduino IDE.

Arduino IDE

The open-source Arduino environment makes it easy to write code and upload it to the i/o board. It runs on Windows, Mac OS X, and Linux. The environment is written in Java and based on Processing, avr-gcc, and other open source software.

Arduino_IDE
Arduino IDE with the code example: Blink

Install in Ubuntu

The easiest and safest way to install it is through the Ubuntu software center looking for Arduino and clicking on the install button.

Búsqueda del Arduino IDE en el Centro de Software de Ubuntu
Search Arduino IDE on Ubuntu Software Center.

But we can also install it using the console as follows:

sudo apt-get install arduino
 If we wanted the latest beta version, although not recommended if you want a stable and with the greatest possible error debugging version. To install use the following instructions:
sudo rm -r /usr/share/arduino 
wget http://arduino.cc/download.php?f=/arduino-1.5.8-linux64.tgz
tar zxvf arduino-1.5.8-linux64.tgz; 
sudo mv ./arduino-1.5.8 /usr/share/arduino;

[+]

Install Pro Trinket in Ubuntu

Pro Trinket V3
Pro Trinket V3

Following the appearance of Arduino increased the number of open-source hardware devices to develop affordable to the general public. An example is Pro Trinket and Trinket,  that like Arduino has a ATmega328 microcontroller and a bootloader that allows you to load your programs directly to the board via USB. But the outstanding features are its ability to connect directly to a battery from 5v to 15v (in the case of the V3 trinket from 3.5v to 16v) and especially its small size. All this makes it ideal for small projects that run with a battery. We can also load programs through the Arduino IDE and 95% of Arduino programs designed to run on Trinket directly, the rest have to change the settings for some pins or not enough space for storage in other cases.

To use with Arduino IDE we have to make a small modification to the boards.txt file in the installation directory Arduino IDE, which is in /arduino/hardware/boards.txt.
In the case of Ubuntu are in: /usr/share/arduino/hardware/boards.txt

To change this I will use gedit, but you can use any text editor. Root permissions are needed for editing, so we have to use sudo.

sudo gedit /usr/share/arduino/hardware/arduino/boards.txt
We will have to introduce this piece configuration, the position at which the put will determine the position in which it appears in the menu in the Arduino IDE to select it.
protrinket5.name=Pro Trinket 5V/16MHz (USB)
protrinket5.upload.using=usbtiny
protrinket5.upload.maximum_size=28672
protrinket5.upload.speed=115200
protrinket5.build.mcu=atmega328p
protrinket5.build.f_cpu=16000000L
protrinket5.build.core=arduino:arduino
protrinket5.build.variant=arduino:eightanaloginputs

[+]

Pythagorean theorem

The origin of the Pythagorean theorem is a mystery, in fact it is not known if it was discovered once or several times in different places. The question is, would it be difficult to deduce? Below you can view an animation with a graphic demonstration of the Pythagorean theorem. You will be surprised what you do not explain it this way before

[+]

Learn science and technology from a different perspective …