Display interfacing

A simple display that can be used with Arduino or Raspberry Pi is an LCD of 16x2 characters. It consists of 16 characters in 2 lines. This LCD module is a low-cost display and easy to use. You can see the form of the LCD 16x2 display here:

If you use LCD 16x2 characters with an Arduino, we can use the LiquidCrystal library. You can read about it at https://www.arduino.cc/en/Reference/LiquidCrystal. I recommend you test with the Hello World tutorial from Arduino on this site: https://www.arduino.cc/en/Tutorial/HelloWorld:

#include <LiquidCrystal.h> 
 
// initialize the library with the numbers of the interface pins 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
 
void setup() { 
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2); 
  // Print a message to the LCD. 
  lcd.print("vending machine!"); 
} 
 
void loop() { 
  // set the cursor to column 0, line 1 
  // (note: line 1 is the second row, since counting begins with 0): 
  lcd.setCursor(0, 1); 
  // print the number of seconds since reset: 
  lcd.print(millis() / 1000); 
} 

Compile and upload this sketch to Arduino. You should see vending machine! on the LCD 16x2 characters module.

Currently, display technology is grow in fast. Touchscreen displays can be used for your vending machine design. For instance, if your core system in the vending machine uses Raspberry Pi, you can use the official Raspberry Pi 7" touchscreen display. You can buy it on https://www.raspberrypi.org/products/raspberry-pi-touch-display/. You can see this display model here:

Follow the assembly instructions for the display from the datasheet document, which included in the box. You can use this assembly file from Adafruit: https://cdn-shop.adafruit.com/product-files/2718/2718build.jpg.

After constructing the display, you should upgrade and install some libraries on Raspberry Pi's Raspbian OS. You can type these commands:

    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get dist-upgrade
    $ sudo apt-get install raspberrypi-ui-mods
    $ sudo apt-get install raspberrypi-net-mods  

Now you can work with the Raspberry Pi 7" touchscreen display like on a tablet.

You can use a UI on Raspberry Pi using a browser. You can create a web application and then that browser inside Raspberry Pi will call it.

Make sure your Raspberry Pi is started in GUI mode. You can configure this via the raspi-config tool. You can call it by typing this command:

    $ sudo raspi-config  

After it has executed, you should see this menu:

Select 3 Boot Options so you have options to select Desktop/CLI for starting on Raspbian boot:

Let's assume we use the Chromium browser on Raspbian Jessie to run our web application. You can install it on Raspberry Pi:

    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get install unclutter  

Then, we configure autostart on Raspberry Pi. Type this command:

    $ nano ~/.config/lxsession/LXDE-pi/autostart  

You can modify this script:

@lxpanel --profile LXDE-pi 
@pcmanfm --desktop --profile LXDE-pi 
@xset s off 
@xset -dpms 
@xset s noblank 
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser Default/Preferences 
@chromium-browser --noerrdialogs --kiosk [URL] --incognito --disable-translate 

Change [URL] to the URL of your web application. It can be a local web or remote web application.

Now you can reboot your Raspberry Pi. Once rebooting is complete, you should see the browser open your web application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.161.77