Arduino Bluetooth Camera

14,672

84

35

Hello!

Today you can hardly surprise anyone with a mobile phone with a camera, wireless gadgets and other technical advances. Thanks to the Arduino platform, millions of people have discovered the wonderful world of electronics and programming. 100,500 instructions were written on how to exchange data between a mobile phone and Arduino via bluetooth ... What am I talking about? Yes. I want to exchange data between a mobile phone on Android and Arduino UNO through bluetooth in 100,501 times. But I want to transmit not just a set of characters and numbers, but pictures.

Someone will say that this is impossible, Arduino is too slow to process large amounts of data with good speed. And he will be absolutely right. And what if a little bit of help Arduino - to transfer all the "hard" work on the shoulders of other device? And there is such a device!

This is a unique TFT shield for Arduino. Information about this logo is in these articles: article 1, article 2. In this instructables, I will demonstrate how you can connect via bluetooth between Arduino and Android phone, get a picture from the OV7670 camera on Arduino UNO and transfer it to Android phone. Then, on the contrary, transfer the picture (image from the camera) from the Android phone to Arduino UNO and display it on the screen of a unique TFT shield.

A special application was written for the Android phone.

Brief characteristics of TFT shield:

  • Size 3.5 " diagonal,

  • Resolution 320x240,

  • Number of colors 65536 (16-bit),

  • Resistive touch screen (XPT2046 controller),

  • 5 buttons,

  • RTC IC DS1307 with 3V lithium battery CR1220,

  • Slot for connecting a micro SD card,

  • 4-pin (2.54 mm) connector for connecting the Bluetooth module HC-05 (-06), ESP8286 WiFi module.

  • 20-pin (2.54 mm) connector for camera (OV7670).

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: List of Components Needed

Hardware:

  1. Arduino UNO;
  2. Unique TFT shield;
  3. AC-DC power adapter 6-12 volt, >600mA;
  4. Camera OV7670;
  5. Bluetooth module HC-06 (HC-05);
  6. Android phone.

Attention: It is necessary (!) To use a 6-12 volt power adapter to operate the TFT shield, because the maximum current of 500 mA from USB is not enough for normal operation.

Software:

  1. Arduino IDE;
  2. Library for Unique TFT shield;
  3. APK file for Android phone.

Step 2: Preparing

Software

All demonstration sketches are written in the Arduino IDE environment, therefore at the beginning it is necessary to install the Arduino IDE - https://www.arduino.cc/en/main/software.
Then you need to install a library for TFT shield - github.com/YATFT/YATFT (download the library and unpack it into the "libraries" folder in the Arduino IDE directory).

After installing the Arduino IDE, you must program the Arduino UNO board. For simplicity, I recommend flashing it separately, without TFT shield. For this:

  • Connect the USB cable to the Arduino UNO board;
  • Run the Arduino IDE on the computer;
  • Select the corresponding port to which the Arduino UNO is connected;
  • Download the ArduinoBluetoothCamera.ino demo sketch (and file ov7670_regs.h for camera init);
  • Click the button Upload.

If the Arduino UNO board is successfully programmed, you can proceed to the next step.

Android

On the Android phone, you need to install the ArduinoTFT.apk. Allow the app to use the Bluetooth and Camera.

Bluetooth module

It is necessary to set the exchange rate in the Bluetooth module to be 115200 (command "AT+UART=115200,0,0"). This is the optimal speed at which Arduino UNO manages to receive and process data. (Theoretically, you can increase the speed, optimize data reception and processing, but this requires a larger amount of RAM).
More detailed instructions on how to set the exchange rate can be found on the Internet, for example, here: https://www.instructables.com/id/Communication-Bluetooth-Module-With-HC-05-HC-06/ .

(!) Please note that the Bluetooth module connects to the debug port of Arduino UNO. Thus, when working with bluetooth, the debug port is not available. And before programming the Arduino UNO (complete with the Bluetooth module) must disconnect the Bluetooth module. And after programming, set it back (!)

Step 3: Assembly

Assembly of the device is quite simple:

  • Connect together Arduino UNO and TFT-shield;
  • Connect the OV7670 camera to the 20-pin connector on the TFT-shield of the shield (sometimes I use an angled 18-20 pin connector with a 2.54 mm pitch as an adapter);
  • Connect the Bluetooth module HC-06 (HC-05) to the 4-pin connector with the words "Bluetooth" on the TFT-shield;
  • Connect the 6-12V power adapter to the power input on the Arduino UNO board.

After turning on the power, the TFT shield's screen should turn red. This means the willingness to receive commands from the Android phone.

Step 4: Demonstration

Perform the following operations on the Android phone:

  • Launch the ArduinoTFT application on the Android phone;
  • Turn the phone in a horizontal position;
  • Enable the Bluetooth connection, select the detected Bluetooth module (HC-06);

Two windows and four buttons should appear on the screen:

  1. The top right window is the phone's camera viewfinder window;
  2. Large left window - received or sent images.

Button functions:

  1. Transfer single image from Android phone to Arduino;
  2. Continuous transfer of images from the Android phone to Arduino;
  3. Transfer single image from Arduino to Android phone;
  4. Continuous transfer of images from Arduino to Android phone.

The image size is 320x240 pixels (2-5 kB). This chapter has a demo video.

If you like my instructable, I would appreciate an assessment. Perhaps this will give me motivation for new instructables :-)

Thanks for attention!

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Be the First to Share

    Recommendations

    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    35 Discussions

    0
    None
    gerarca88

    3 months ago

    When I open APP Android this message appears "Unfortunately, ArduinoTFT has Stopped"

    12 replies
    0
    None
    A81010gerarca88

    Reply 3 months ago

    What device are you running the app on? Try before starting the application to turn on bluetooth on your device and connect to HC-06. And try to keep the phone horizontal.

    0
    None
    gerarca88A81010

    Reply 3 months ago

    I have a Samsumg Galaxy S4.
    I'm using CH-05, i's configurated and it work with anotrher code.
    the phone should keep the phone horizontal to it work ????

    0
    None
    A81010gerarca88

    Reply 3 months ago

    Try to update the application (the minimum version of Android has been reduced to 4.0.0). New app ArduinoTFT_v14.apk.

    0
    None
    gerarca88A81010

    Reply 3 months ago

    Hi! You used APP Inventor to create App ArduinoTFT ????

    0
    None
    gerarca88A81010

    Reply 3 months ago

    What kind of software did you used to create App ArduinoTFT ????

    0
    None
    gerarca88A81010

    Reply 3 months ago

    hmmm ok... you can send me the code to App ArduinoTFT

    0
    None
    chithirans

    3 months ago

    amazing.... i want to know how to transfer files from android phone to arduino please give me a solutions.

    0
    None
    gerarca88

    3 months ago

    Hello! Im trying to run your code, but when it's running this error appears:

    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawLine(unsigned int, unsigned int, unsigned int, unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawPoly(int, int*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawFillRect(int, int, int, int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawArc(int, int, int, int, int, int, unsigned char)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawFillBevel(int, int, int, int, int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::PutPixel(int, int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::DrawBevel(int, int, int, int, int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::rdReg8(unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::rdReg16(unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::rdReg32(unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::GetMemBuff(unsigned long, unsigned char*, unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::GetMem(unsigned long)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `INTRFC::PutMemBuff(unsigned long, unsigned char*, unsigned int)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::MainWndInit(unsigned long, unsigned int, unsigned int, unsigned char, unsigned char)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::FloatWndInit(unsigned long, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::FocusWnd(unsigned char)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::SetFont(GFXfont const*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::OutChar(unsigned char)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::OutText(unsigned char*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::GetTextWidth(char*, void*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::GetTextHeight(void*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    libraries\YATFT-master\YATFT2.cpp.o (symbol from plugin): In function `YATFT::LCD_SetCursorPosition(unsigned int, unsigned int, unsigned int, unsigned int)':
    (.text+0x0): multiple definition of `YATFT::OutTextXY(int, int, char*)'
    libraries\YATFT-master\YATFT.cpp.o (symbol from plugin):(.text+0x0): first defined here
    collect2.exe: error: ld returned 1 exit status
    exit status 1
    Error compilando para la tarjeta Arduino/Genuino Uno.


    what im doind wrong?

    4 replies
    0
    None
    A81010gerarca88

    Reply 3 months ago

    Try deleting files YATFT2.cpp and YATFT2.h and compiling again.

    0
    None
    gerarca88A81010

    Reply 3 months ago

    Hello! I deleted files YATFT2.cpp and YATFT2.h and compiled. I have a another question, what is the code's App???...

    0
    None
    A81010gerarca88

    Reply 3 months ago

    Sorry, did not understand the question. Can you rephrase?

    0
    None
    gerarca88A81010

    Reply 3 months ago

    The code is running without problem....... deleting the files YATFT2.cpp and YATFT2.h, it work......

    so, I want to know how I can do the APP ArduinoTFT.apk, I want to learn how a can program an application like ArduinoTFT.apk.

    0
    None
    guedda

    6 months ago

    Can I use another type of TFT Shield display?