This video will show you how to get started with Maker pHAT.
1 – PREPARING HARDWARE
To get started, we recommend you to have:
2 – INSTALL THE LATEST RASPBIAN OS
After done flashing, take the SD card out and insert back to your laptop. Open SD card directory (e.g. D:/boot) and open config.txt file. Put enable_uart=1 at the bottom of the line. Save and eject the SD card. Then insert the SD card into Raspberry Pi Zero WH.
3 – INSTALL MAKER PHAT DRIVER
Don’t stack the Maker pHAT to Raspberry Pi Zero WH yet. Connect Maker pHAT to your laptop using USB Micro B Cable. Check either your laptop is able to detect the Maker pHAT. Open Device Manager, and check under Ports (COM & LPT) category. It should be detected as USB-SERIAL CH340 (COM number). If yes, you can proceed to the next step. If not, download and install Maker pHAT driver.
Download and install Maker pHAT driver. Please choose appropriate driver depends on your laptop/PC operating system:
4- INSTALL PUTTY (WINDOWS)
For Windows user, download and install PuTTY. Connect your Maker pHAT to your laptop using USB Micro B Cable. Since Maker pHAT is already stacked on the Raspberry Pi, this connection will power up Raspberry Pi through Maker pHAT. Please be reminded to do not easily disconnect the cable without proper shutdown.
Open PuTTY software. Tick on the Serial, then write your COM number (e.g. COM3). Please refer to your Device Manager. Set Speed to 115200. Then click Open.
Press Enter, then insert Raspberry Pi default login information as follow.
- raspberrypi login: pi
- password: raspberry
So far, you’re able to access Raspberry Pi through serial remote (Maker pHAT). We will further guide you until we can remote using VNC Viewer (Virtual Network Computing).
5 – CONNECT TO WIFI
To remote using VNC Viewer, we need a WiFi connection. We can set the WiFi connection in Raspberry Pi Software Configuration Tool. Write the following command and Enter.
Go to number 2 Network Options. Then Enter.
Choose N2 Wi-fi and Enter.
Choose your country and press Enter.
Write your WiFi SSID (Enter), followed by WiFi passphrase (Enter).
Done setting for WiFi connection. Press Enter to <Ok>.
Next, we need to enable VNC server in Raspberry Pi. Go back to the top menu, and select to the number 5 Interfacing Options.
Select P3 VNC.
Choose <Yes> to enable VNC, and Enter.
VNC server is enabled. Press Enter to <Ok>.
Press Esc to exit Raspberry Pi Configuration Tool. Now, reboot Raspberry Pi to enable WiFi connection and VNC server. Write following command followed by Enter.
Login to Raspberry Pi like previous. If all your setting is correct, your Pi will connect to WiFi. Next we need to trace the IP address. Write following command and Enter.
Your Raspberry Pi will display IP address (e.g. 192.168.0.106).
We recommend you to update your Raspbian with following command.
sudo apt-get update
Done update, open VNC Viewer and insert Raspberry Pi’s IP address on the text bar. Then press Enter.
A warning window will popup. Sometimes the warning is in yellow and sometimes in red. Proceed with Continue button.
Fill up Raspberry Pi default login information.
- Username: pi
- Password: raspberry
Tadaa. Your VNC remote is successful. Now you can access Raspberry Pi Desktop through VNC Viewer and WiFi connection.
MAKER PHAT DEMO CODE (PYTHON)
You can try the demo code below using Python 3 (IDLE).
|from gpiozero import LED, Button, Buzzer|
|from time import sleep|
|LED1 = LED(17)|
|LED2 = LED(18)|
|LED3 = LED(27)|
|LED4 = LED(22)|
|LED5 = LED(25)|
|LED6 = LED(12)|
|LED7 = LED(13)|
|LED8 = LED(19)|
|SW1 = Button(21)|
|SW2 = Button(16)|
|SW3 = Button(20)|
|BUZZER = Buzzer(26)|
|NONE = 0|
|DECREASE = 1|
|INCREASE = 2|
|ALL_OFF = 9|
|ALL_ON = 10|
|def beep(times, sec):|
|for x in range(times):|
|if ledNumber == 1:|
|if ledNumber == 2:|
|if ledNumber == 3:|
|if ledNumber == 4:|
|if ledNumber == 5:|
|if ledNumber == 6:|
|if ledNumber == 7:|
|if ledNumber == 8:|
|if ledNumber == ALL_OFF:|
|elif ledNumber == ALL_ON:|
|mode = NONE|
|ledPosition = 0|
|if SW1.is_pressed and mode != DECREASE:|
|mode = DECREASE|
|elif SW2.is_pressed and SW3.is_pressed:|
|for loop in range(3):|
|os.system("sudo shutdown -h now")|
|elif SW2.is_pressed and mode != INCREASE:|
|mode = INCREASE|
|elif SW3.is_pressed and mode != NONE:|
|mode = NONE|
|if mode == INCREASE:|
|if ledPosition < 8:|
|ledPosition = ledPosition + 1|
|ledPosition = 0|
|elif mode == DECREASE:|
|if ledPosition > 0:|
|ledPosition = ledPosition - 1|
|ledPosition = 8|
MAKER PHAT DEMO CODE VIDEO
This video will show you how the demo code works on Maker pHAT.