background image

SunFounder RasPad 3

www.sunfounder.com

May 10, 2022

Summary of Contents for RasPad 3

Page 1: ...SunFounder RasPad 3 www sunfounder com May 10 2022 ...

Page 2: ......

Page 3: ...NTRODCTION 37 6 1 Charge the RasPad 38 6 2 Volume and Brightness Settings 41 6 3 Connect Headphones or Other Screens 44 7 RASPAD PROJECTS AND ACTIVITIES 49 7 1 Multimedia Options 49 7 1 1 Watch Video 49 7 1 2 Read E book 50 7 1 3 Play Game 51 7 2 Retro Games Console 52 7 2 1 Description 52 7 2 2 Required Components 53 7 2 3 Game System Installation 55 7 2 4 RetroPie Configuration 58 7 3 3D Printer...

Page 4: ...nt Box 186 7 7 10 Eating Banana Game 201 7 7 11 Create Musical Instrument 205 7 7 12 DIY RasPad Monitor Device 211 7 8 Install Other Systems on RasPad 217 8 APPENDIX 219 8 1 Assemble the Camera Module 219 8 2 GPIO Extension Board 223 8 3 Obtain the IP Address of the Raspberry Pi 225 8 3 1 With a Screen 225 8 3 2 Without a Screen 226 8 4 Use the SSH Remote Control 227 9 FAQ 231 9 1 Fix Raspberry Pi...

Page 5: ...he table or rotate it 90Âr 180Âr 270Âr to give amazing presentations With all the Raspberry Pi ports including Ethernet HDMI Audio USB and Power All the RPi I O interface a customized OS stereo speakers and many more features for developers to have a convenient hardware hacking experience specially designed GPIO Extension and camera holes making users build projects or install cameras for RasPad Y...

Page 6: ...SunFounder RasPad 3 2 Contents ...

Page 7: ...to disconnect the power adapter to avoid battery damage caused by long term charging 1 2 Precautions about the maintenance of lithium batteries Lithium batteries can be stored in a clean dry and ventilated room with an ambient temperature of 5Âr CâA T 35Âr C and a relative humidity of not more than 75 Avoid contact with corrosive substances and keep away from fire and heat sources Do not store the...

Page 8: ...SunFounder RasPad 3 4 Chapter 1 SAFETY NOTICES ...

Page 9: ...5 ...

Page 10: ...SunFounder RasPad 3 Chapter 2 COMPONENTS LIST 6 Chapter 2 COMPONENTS LIST ...

Page 11: ...the Raspberry Pi using the included FFC cable 2 Connect all the cables and then attach the Raspberry Pi with four of the M2 5x4 screws 3 Orient the fan so the logo is facing the exterior vent then attach the fan with the four PWA1 7X9 screws 4 Finally attach the back cover with five M2 5x4 screws 7 ...

Page 12: ...SunFounder RasPad 3 Detailed Assembly Steps Take out the RasPad then flip it over to remove the back cover 8 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 13: ...SunFounder RasPad 3 Below is an image of the internal structure of the RasPad Note Avoid pressing on the two speakers during assembly Connect the Ethernet port of the Raspberry Pi and the Main Board 9 ...

Page 14: ...SunFounder RasPad 3 Connect the Raspberry PiâA Z s USB 3 0 port to the RasPad Main Board with the included USB cable 10 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 15: ...SunFounder RasPad 3 Connect the two Micro HDMI cables Note Cable A is slightly longer than Cable B 11 ...

Page 16: ...SunFounder RasPad 3 Connect the USB C cable 12 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 17: ...SunFounder RasPad 3 Plug the FFC cable into the Micro SD card board Insert the Micro SD card board into the Raspberry PiâA Z s Micro SD card slot 13 ...

Page 18: ...SunFounder RasPad 3 Insert the other end of the FFC cable into the RasPad button board Fix the Raspberry Pi with 4 M2 5x4 screws 14 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 19: ...SunFounder RasPad 3 Attach the three heat sinks to the Raspberry Pi and insert the Accel SHIM module for the RasPadâA Z s auto rotate function 15 ...

Page 20: ...SunFounder RasPad 3 To use the GPIO pins of the Raspberry Pi connect a 40 pin GPIO ribbon cable to the Raspberry Pi and route the ribbon cable out the top of the case 16 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 21: ...SunFounder RasPad 3 Attach the fan onto the back cover with four PWA1 7X9 screws Note The logo faces out towards the exterior vent 17 ...

Page 22: ...M2 5x4 screws Note Do not force the back cover in place If the enclosure is hard to connect or the screw holes do not line up correctly please check that there are no internal components interfering with the fit before trying to reattach the back cover 18 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 23: ...SunFounder RasPad 3 19 ...

Page 24: ...SunFounder RasPad 3 20 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 25: ...s an operating system installed Raspberry Pi Imager is a quick and easy way to install the Raspberry Pi operating system to a Micro SD card from a computer or laptop Browse to the Raspberry Pi Imager site and download the version that matches the computer or laptopâA Z s operating system www raspberrypi org software When the download is complete launch the installer program and follow the prompts ...

Page 26: ...not work so it is recommended to continue using the Debian Buster version In the Raspberry Pi Imager click CHOOSE OS Raspberry Pi OS other Scroll down to the end of the newly opened page and you will see Raspberry Pi OS Legacy and Raspberry Pi OS Lite Legacy these are security updates for Debian Buster the difference between them is with or without the desktop It is recommended to install Raspberr...

Page 27: ...SunFounder RasPad 3 Select the SD card you are using Click the WRITE button 4 1 Install the Raspberry Pi OS 23 ...

Page 28: ...ny files already on the SD card If the SD card has any files back up these files before clicking Yes After the Imager completes installing the Operating System on the SD card click Continue to complete the installation 24 Chapter 4 QUICK USER GUIDE ...

Page 29: ...wer button for over three seconds RasPad will turn on The power button is on the right side Press and hold for over three seconds to power the RasPad on or off A short press will turn the screen on or off Note Before use it is recommended to fully Charge the RasPad 4 1 Install the Raspberry Pi OS 25 ...

Page 30: ...text input operation but it is best to install a virtual keyboard Install the required software with the following command sudo apt install onboard y sudo apt install at spi2 core In order to make the virtual keyboard have a better effect you need to do further settings Click the Raspberry Pi icon in the upper left corner and select Preferences Onboard Settings In the General option check the foll...

Page 31: ...SunFounder RasPad 3 In the Window option check Dock to screen edge And in Auto show option check Auto show when editing text again 4 2 Install Virtual Keyboard on RasPad 27 ...

Page 32: ...The next 2 items are optional the ones checked in the picture are recommended by us you can also check other ones In Layout option Small is recommanded In Theme option DarkRoom is recommanded 28 Chapter 4 QUICK USER GUIDE ...

Page 33: ...Founder RasPad 3 After the setting is complete restart RasPad Every time you restart RasPad you need to click General Access Onboard to enable the virtual keyboard 4 2 Install Virtual Keyboard on RasPad 29 ...

Page 34: ...SunFounder RasPad 3 Now you can use this keyboard to edit your files or codes 30 Chapter 4 QUICK USER GUIDE ...

Page 35: ...lick command still available Enter the following command to install the required software sudo apt install build essential libevdev2 libevdev dev y git clone https github com PeterCxy evdev right click emulation git cd evdev right click emulation Enter the following command to build make all Copy the file to the usr directory sudo cp out evdev rce usr local bin Make it executable sudo chmod x usr ...

Page 36: ...Pi when the RasPad was assembled and now we write a script to enable the RasPad to automatically rotate the screen This script currently supports the following systems Currently supports Raspberry Pi OS Twister OS Ubuntu Desktop 21 04 Run the following commands to install it git clone https github com raspad tablet raspad auto rotator cd raspad auto rotator sudo python3 install py After installati...

Page 37: ... calibrate Or rotate RasPad slowly 720 degrees on three axes and it will also auto calibrate If it still doesnâA Z t work at some angles no matter how you rotate and calibrate it in that case try to recalibrate it with the command raspad auto rotator reset After running the above command the auto rotator will restart Now recalibrate according to the 2 methods mentioned before 4 4 Install Rotating ...

Page 38: ...SunFounder RasPad 3 34 Chapter 4 QUICK USER GUIDE ...

Page 39: ...ncher is an open source software that simulates a launcher menu with a focus on improving the users touchscreen experience with the RasPad or other touchscreens Note If you want to use the original desktop of the Raspberry Pi you can skip this chapter 35 ...

Page 40: ...p raspad launcher zip cd raspad launcher The script will install the following RasPad launcher with desktop profile RasPad FAQ desktop profile Just a quick icon to browser RasPad FAQ webpage display auto rotate for Accl SHIM Run install script chmod x install sudo install Note To manually install RasPad Launcher and specific components please refer to RasPad Launcher 36 Chapter 5 RASPAD LAUNCHER ...

Page 41: ...rnal button board Power Button Press and hold for over three seconds to power the RasPad on or off A short press will turn the screen on or off Volume Press to enter the volume adjustment stateïijZ If Brightness is pressed first it can be used to increase the brightness when pressed this button Brightness Press to enter the brightness adjustment state If Volume is pressed first it can be used to d...

Page 42: ...hernet port USB 3 0 Port Standard USB 3 0 port HDMI Port It can be used as an expansion screen through this port Headphone Jack Standard headphone jack Power Supply Port 15V 2A DC port 6 1 Charge the RasPad The number of green LEDs indicates battery percentage When the low battery warning icon appears it indicates that RasPad needs to be charged Take out the power adapter and power cable 38 Chapte...

Page 43: ...SunFounder RasPad 3 Insert one side of the power cable into the power adapter and the other side to an outlet 6 1 Charge the RasPad 39 ...

Page 44: ...Pad 3 Plug the power adapter into the RasPad power port At this time one of the green LED might be blinking and the charging icon will appear indicating that the RasPad is charging 40 Chapter 6 INTERFACES INTRODCTION ...

Page 45: ...w be lit indicating that the RasPad is powered on At this point the RasPad should be booted up If the screen is too bright give the brightness button a short press to enter the screen brightness adjustment page A brightness adjustment bar will appear on the screen 6 2 Volume and Brightness Settings 41 ...

Page 46: ...sted via these two buttons After three seconds without operation the brightness bar on the screen automatically disappears The brightness should not be too high or too low otherwise it will be harmful to the eyes 42 Chapter 6 INTERFACES INTRODCTION ...

Page 47: ...SunFounder RasPad 3 To adjust the volume press the volume button once to enter the volume adjustment page Then press these two buttons to adjust the volume 6 2 Volume and Brightness Settings 43 ...

Page 48: ...es or Other Screens Plug in the headphone if you need The headphone volume can only be adjusted on the desktop screen Enter the Raspberry Pi desktop by tapping the top left menu icon of the RasPad Launcher 44 Chapter 6 INTERFACES INTRODCTION ...

Page 49: ...appear Slide the volume cursor up or down tto adjust the headphoneâA Z s volume Warning When wearing headphones do not adjust the volume too high Use the HDMI port to add a second monitor and the USB ports for a mouse and a keyboard 6 3 Connect Headphones or Other Screens 45 ...

Page 50: ...SunFounder RasPad 3 46 Chapter 6 INTERFACES INTRODCTION ...

Page 51: ...SunFounder RasPad 3 6 3 Connect Headphones or Other Screens 47 ...

Page 52: ...SunFounder RasPad 3 48 Chapter 6 INTERFACES INTRODCTION ...

Page 53: ...projects to choose from 7 1 Multimedia Options Watch videos read e books or play games on the RasPad 7 1 1 Watch Video The RasPad has a built in video player VLC Video Player Watch a local video directly by double clicking on the VLC Video Player icon or log in to the YouTube website from Google Chrome browser to watch videos 49 ...

Page 54: ...SunFounder RasPad 3 7 1 2 Read E book Read online from the Google Chrome browser 50 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 55: ...nFounder RasPad 3 7 1 3 Play Game Click Preferences Recommended Software Games to install games on RasPad 3 For example install Minecraft and plug in a keyboard and mouse to play 7 1 Multimedia Options 51 ...

Page 56: ...under RasPad 3 7 2 Retro Games Console 7 2 1 Description You can turn RasPad 3 into a retro games console playing with your friends letâA Z s see how we can do it 52 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 57: ... is recommended to use a Raspberry Pi 4 as the main control board with Retro Pie as the Operating System That Raspberry Pi uploads or downloads the game system and game ROM needs taking up a large memory so it is recommended to use a large capacity SD card to avoid configuration failures 7 2 Retro Games Console 53 ...

Page 58: ...keyboard are needed The RasPad is equipped with a 1280x800 LCD touch screen a 2 watt stereo speaker and three USB 3 0 ports allowing for high resolution and sound quality to provide an excellent gaming experience 54 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 59: ...turn your Raspberry Pi ODroid C1 C2 or PC into a retro gaming machine It builds upon Raspbian OS Emulation Station RetroArch and many other projects to enable you to play your favorite Arcade home console and classic PC games with the minimum set up 7 2 Retro Games Console 55 ...

Page 60: ...SunFounder RasPad 3 Installing RetroPie Step 1 Download the SD image compatible with the Raspberry Pi 4 on the RetroPie official website 56 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 61: ...te Win32DiskImager requires an img file extracted from the img gz image downloaded in step 2 You can use a program like 7zip to do this For macOS use Raspberry Pi Imager Etcher Apple Pi Baker or the dd command For Linux use Raspberry Pi Imager Etcher or the dd command Note MacOS Linux users can optionally extract the img image from the downloaded img gz by using gunzip macOS users can also simply ...

Page 62: ...ame ROMs A keyboard and a gamepad are needed when doing these steps The detailed steps are shown in the video Note 1 You can also go to RetroPie official website to detailed tutorial RetroPie Docs 2 RetroPie allows you to turn your Raspberry Pi or PC into a retro gaming machine But because of the na ture complexity of copyright intellectual property law country specific RetroPie doesnâA Z t provid...

Page 63: ... schedule prints and remotely control the printer Please refer to the detailed installation tutorial for OctoPrint https community octoprint org t setting up octoprint on a raspberry pi running raspbian or raspberry pi os 2337 This tutorial has written very detailed installation steps which may take a long time and requires more patience Note The Raspberry Pi Operating System will need to be insta...

Page 64: ...file to be readable and writable chmod 644 config lxsession LXDE pi autostart nano config lxsession LXDE pi autostart Open the autostart file with a text editor such as Nano and add the following line to the end of the file to make the RasPad execute the startTouchUI sh script file on boot home pi startTouchUI sh After restarting the RasPad the OctoPrintâA Z s Touch UI will open in full screen mod...

Page 65: ...ra please note that in the choose components step Open STL files with Cura has been checked by default so that stl files can be sliced If you want to slice other types of model files check the corresponding option otherwise you can install it directly 7 3 3D Printer Monitor 61 ...

Page 66: ...ad 3 When opening Ultimaker Cura for the first time there will be a series of configuration prompts At the Add a Printer step select the model of printer used and click Next 62 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 67: ...ct printer model verify that the parameters provided by Ultimaker Cura in the Machine Settings page are correct or change the parameters directly Follow the onscreen prompts to complete the configuration of Ultimaker Cura 7 3 3D Printer Monitor 63 ...

Page 68: ...fully launched click the Folder icon in the upper left hand corner and browse to the folder with the stl 3D model file that needs to be sliced and click Open to add the stl file to Ultimaker CuraâA Z s library 64 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 69: ...ner and Ultimaker Cura will automati cally perform the slicing operation After slicing is complete click the Save to Disk option in the lower right corner to save the sliced âA N âA N file locally Select the type of file extension recognized by the 3D printer then click Save 7 3 3D Printer Monitor 65 ...

Page 70: ...to log in to OctoPrint Note Before logging in to the OctoPrintâA Z s web UI OctoPrint will first need to have been successfully installed on the RasPad The IP address 192 168 18 179 will need to be replaced with the local IP address of the RasPad Hover the cursor over the WiFi icon on the RasPad desktop and the local IP address will be displayed Now you have entered OctoPrint 66 Chapter 7 RASPAD P...

Page 71: ...SunFounder RasPad 3 Click the Upload option to select the sliced âA N âA N 3D model file 7 3 3D Printer Monitor 67 ...

Page 72: ...rinter will start to print the 3D model file after the slicing process is complete If you have transferred the sliced âA N âA N file to the Raspberry Pi you can also open the OctoPrint UI in RasPad to print 68 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 73: ... assistant on the Raspberry Pi without having to send your data out onto the internet This means that you have total control over your data limit the amount of internet traffic from your smart devices and tighten up security And RasPad 3 is powered by Raspberry Pi 4 with 10 1âA I HD touch screen and 5 hours battery life We also wrote scripts for it to boot up and full screen self start so you can ...

Page 74: ...Y_TIME_ZONE v home pi homeassistant config network host ghcr io home assistant raspberrypi3 homeassistant stable If you are using Raspberry Pi 4 run the following commands to install the Home Assistant sudo docker run d name homeassistant privileged restart unless stopped e TZ MY_TIME_ZONE v home pi homeassistant config network host ghcr io home assistant raspberrypi4 homeassistant stable Note For...

Page 75: ...is a tool which aims to make managing your ESP boards as simple as possible It reads in a YAML configuration file just like Home Assistant and creates custom firmware which it installs on your ESP device Devices or sensors added in ESPHomeâA Z s configuration will automatically show up in Home AssistantâA Z s UI Installation 1 Installation dependencies sudo pip3 install cryptography 2 8 2 Install ...

Page 76: ...tp localhost 6052 or http X X X X 6052 replace X X X X with your Raspberry PiâA Z s IP address 2 Create configuration Click on the âA IJ âA I to start adding configurations Enter a name and the WiFi and password that you need to have your device connect to and then click NEXT 72 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 77: ...SunFounder RasPad 3 Select the device type ESP32 for example 7 4 Home Assistant 73 ...

Page 78: ...ee them in the Dashboard of ESPHome Note When it is not the first time to add a device click âA IJ âA I on the main page follow the prompts to enter the device name WIFI and password select the device type 74 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 79: ...SunFounder RasPad 3 3 Edit the yaml file Click EDIT in the bottom right corner to go inside the yaml file you will see the following default components 7 4 Home Assistant 75 ...

Page 80: ...the ESPHome tool and Home Assistant use this native API ota With the OTA Over The Air update component you can upload your firmware binaries to your node without having to use a USB cable for uploads wifi This core ESPHome component sets up WiFi connections to access points for you It needs to be in your configuration or otherwise ESPHome will fail in the config validation stage captive_portal The...

Page 81: ...components There are a lot of components in the ESPHome official website including Sensor Components Output Components Light Components etc Here we take Binary Light in Light Components as an example Add the following code to the end of the yaml file Example configuration entry light platform binary name Desk Lamp output light_output output id light_output platform gpio pin GPIO16 7 4 Home Assista...

Page 82: ...Wirelessly and USB Port But for the first installation you need to connect the ESP32 board to the Raspberry Pi using USB and then choose the second installation method At a later time you can install and compile via Wirelessly It takes about 10 minutes to download the dependencies during the first compilation so please be patient 78 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 83: ...o Home Assistant Note If there is no response when clicking INSTALL please clear the browser cache and INSTALL again sudo rm rf cache chromium ESPHome configuration is complete and you can now add it to Home Assistant 7 4 3 Log In 1 Now you can enter http ip 8123 in the browser to enter the Home Assistant operation interface Then set up a username and password for your Home Assistant 7 4 Home Assi...

Page 84: ...SunFounder RasPad 3 2 Create a name for your home and select your region 80 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 85: ...SunFounder RasPad 3 3 Select the content you want to share to Home Assistant 7 4 Home Assistant 81 ...

Page 86: ... You can choose to configure the device now or later It is recommended that beginners configure the device later as the configuration is described in detail later in the tutorial 82 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 87: ...ter your login username and password in the login screen Note If the login screen does not jump automatically please open Home Assistant again via http localhost 8123 After logging in successfully you will enter your Home 7 4 Home Assistant 83 ...

Page 88: ...ith ESP32 and add it in In this section you will learn how to add your smart devices 1 Configure the Smart Device You need to make sure that your smart device has been assigned an IP You can complete this step through the corre sponding APP of the smart device For example the picture below shows a bedside lamp configured with HomeKit 84 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 89: ...SunFounder RasPad 3 2 Add Integration Now visit http ip 8123 to access your Home Assistant then click Configuration in the left column and select Inter grations 7 4 Home Assistant 85 ...

Page 90: ...Founder RasPad 3 If Home Assistant finds a device on your network it will display the corresponding integration which can be easily added with just a few clicks 86 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 91: ... been discovered yet donâA Z t worry click the ADD INTEGRATION button at the bottom right and search for your integration in the list Each integration may be different in use you can visit Home Assistant Integration for details 7 4 Home Assistant 87 ...

Page 92: ...t appear you need to Edit Dashboard Click Overview Edit Dashboard ADD CARD you can select the corresponding CARD according to your needs for example select Button here and then select the corresponding Entity After adding the corresponding card click Done to exit editing and then you can control your smart device 88 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 93: ...can also make your DIY device with ESP32 and add it in In this section you will learn how to add your DIY device Before you start the following operations you need to complete Install and configure ESPHome Add Integration 1 Now visit http ip 8123 to access your Home Assistant click Settings in the left column select Devices Services 7 4 Home Assistant 89 ...

Page 94: ...work it will display the corresponding integration which can be easily added with just a few clicks If your smart device is not yet discovered donâA Z t worry you can add it via the ADD INTERGATION button at the bottom right 90 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 95: ...ome in the pop up window and fill in the Host the IP recorded after the INSTALL step in chapter Install and configure ESPHome with the option to place your esp light in the bedroom kitchen or other area of your choice 7 4 Home Assistant 91 ...

Page 96: ...ashboard Now a CARD needs to be added to control this esp light Click Overview Edit Dashboard ADD CARD you can select the corresponding CARD according to your needs for example select Button here and then select the corresponding Entity 92 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 97: ...asPad 3 After clicking SAVE you will be able to use this Button to control the esp light if you connect an LED to GPIO16 in ESP32 board click on the Button to make the LED light up or turn off 7 4 Home Assistant 93 ...

Page 98: ...terface first Please close the already open Home Assistant URL and run chromium browser start fullscreen http localhost 8123 If you want to automatically display the Home Assistant interface in full screen after booting then do the following 1 Go to the autostart folder cd home pi config autostart Note If the autostart folder does not exist you need to create a new one sudo mkdir p home pi config ...

Page 99: ...upper column of the screen and click the exit button that appears Method 3 Right click the pop up menu select âA IJExit full screenâA I Touch screen Long press the blank space to pop up the menu click the exit button at the top of the screen or select âA IJExit full screenâA I 7 4 Home Assistant 95 ...

Page 100: ...y structure is as follows storage directory contains a lot of user related information including user login information user name password encrypted in auth_provider homeassistant file configuration yaml User edited configuration files home assistant log Run log cleared with each reboot home assistant_v2 db Database storage Various elements of front end configuration 96 Chapter 7 RASPAD PROJECTS A...

Page 101: ...o apt update sudo apt upgrade y Install update the required packages sudo apt install git python3 python3 pip y Install Cloud4RPi with the following command sudo pip3 install cloud4rpi Note This tutorial provides the installation method for Python 3 0 and above For lower versions of Python the commands may need to be modified Login to Cloud4RPi on Your Computer Open Chromium Web Browser and enter ...

Page 102: ... and Control Panels to display the information received or sent from the Raspberry Pi on the webpage Connect Your Raspberry Pi to Cloud4RPi After logging in click the Devices option and then click New Device Give the new device a name and copy the current Device token to the clipboard 98 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 103: ...loud4rpi raspberrypi python sudo nano control py Find the following line of code DEVICE_TOKEN __YOUR_DEVICE_TOKEN__ Replace __YOUR_DEVICE_TOKEN__ with the Device token copied from the Cloud4RPi Press Ctrl X to complete the modification DEVICE_TOKEN 556UfPaRw6r6rDKYfzx5Nd1jd Run the sample file control py sudo python3 control py Browse back to the Cloud4RPi server page If your Raspberry Pi is conne...

Page 104: ...onents or display sensor data After entering Control Panels click the New Control Panel button Note Always run the control py file before using the Control Panel Enter a Control Panel name and then click on the Add Widget button Before clicking the Add Widget button again you need to select the appropriate widget and the variable to be dis played 100 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 105: ...SunFounder RasPad 3 For example we select the Text widget and then select Hot Water Âr C so that we can see it on the newly created control panel 7 5 Cloud4RPi 101 ...

Page 106: ...h one and you need to fill in the variable DEVICE_TOKEN with the correct device token in order to connect to the corresponding device DEVICE_TOKEN 556UfPaRw6r6rDKYfzx5Nd1jd variables is a 2 dimensional dictionary and the value corresponding to each of its keys is also a dictionary The keys of the variables dictionary are Room Temp LED On CPU Temp STATUS Location which are all data displayed on the...

Page 107: ...e humidity value in the corresponding bind key variables Room Temp type numeric if ds_sensors else string bind ds_sensors 0 if ds_sensors else sensor_not_connected LED On type bool value False bind led_control CPU Temp type numeric bind rpi cpu_temp STATUS type string bind listen_for_events Location type location bind get_location The vdiagnostics stores information about the Raspberry Pi and is u...

Page 108: ...4RPi Experimental Procedures Build the circuit Open the code cd home pi cloud4rpi raspberrypi python sudo nano temperature_and_humidity_acquisition py Find the line below and fill in the correct device token DEVICE_TOKEN __YOUR_DEVICE_TOKEN__ Run the code sudo python3 temperature_and_humidity_acquisition py Go to Cloud4RPi add a new Control Panel named project1 and click Add Widget 104 Chapter 7 R...

Page 109: ...SunFounder RasPad 3 Select a Chart widget with both Room Temp and CPU Temp as the variables to be displayed 7 5 Cloud4RPi 105 ...

Page 110: ...3 Once added you will see the temperature Room Temp and humidity CPU Temp curves over time and you can adjust the display window by clicking on the options at the bottom right 106 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 111: ...ure result 1 is obtained by this function and the function will not be interrupted until the reading is successful def getHum result dht11 get_result while True if result break else result dht11 get_result return result 0 The humidity result 0 is obtained by this function and the function will not be interrupted until the reading is successful variables Room Temp continues on next page 7 5 Cloud4R...

Page 112: ... the web page Remote Switch In this project we will learn to use Cloud4RPiâA Z s Switch to control the relay thereby controlling the relayâA Z s load LED You can also change the load of the relay to household appliances but with safety in mind Experimental Procedures Build the circuit Open the code cd home pi cloud4rpi raspberrypi python sudo nano remote_switch py Find the line below and fill in t...

Page 113: ...SunFounder RasPad 3 Go to Cloud4RPi add a new Control Panel named project2 and click Add Widget to add a Switch widget Once added you can use the Switch widget to control the relay 7 5 Cloud4RPi 109 ...

Page 114: ...e relay Note Since the relay works at high level the relay closes when the switch state is True and opens when the switch state is False variables LED On type bool value False bind relay_control By setting the value of the value key we can set the initial value of the Switch widget then always read the value of the value key and send the current level of RELAY_PIN the value returned by the functio...

Page 115: ...pi raspberrypi python sudo nano smart_light py Find the line below and fill in the correct device token DEVICE_TOKEN __YOUR_DEVICE_TOKEN__ Run the code sudo python3 smart_light py Go to Cloud4RPi add a new Control Panel named project3 and click Add Widget to add a Slider widget 7 5 Cloud4RPi 111 ...

Page 116: ...SunFounder RasPad 3 Once added you can use the Slider widget to control the brightness of the LED 112 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 117: ... value of the Slider widget then always read the value of the value key and send the current level of LED_PIN the value returned by the function led_control to Cloud4RPi Smart Curtain In this project we will simulate a scenario where the curtains are automatically opened or closed according to the brightness of the room When the photoresistor detects that the room brightness is too bright Raspberr...

Page 118: ... smart_curtain py Find the line below and fill in the correct device token DEVICE_TOKEN __YOUR_DEVICE_TOKEN__ Run the code sudo python3 smart_curtain py Go to Cloud4RPi add a new control panel named project4 and add 3 widgets Switch Text and Chart widgets via the Add Widget button 114 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 119: ... can see the change over time in the Chart widget Code Explanation def getValue analogVal ADC0834 getResult if analogVal 100 move clockwise sleep 5 move stop elif analogVal 20 move contrarotate sleep 5 move stop return analogVal Read the value of channel CH0 with photoresistor connected of the ADC0834 If the value is 100 the motor rotates clockwise for 5 seconds If the value is less than 20 the mo...

Page 120: ...e system In this project we use MFRC522 RFID Module and Cloud4RPi to make a system you can view the attendance information on Cloud4RPi or open the local csv file to view the attendance records Due to the delay of network data transmission the project only allows you to punch in when the green LED is on and upload data when the red LED is on Experimental Procedures Build the circuit 116 Chapter 7 ...

Page 121: ...Cloud4RPi add a new control panel named project5 and add 2 widgets text and chart widgets via the Add widget button Once added you can view the clock in records for different time periods on the Chart widget when the value of LED ON is True it means someone clocked in and then view the number of people who clocked in on the Text widget Also you can find the csv file with the date under the path ho...

Page 122: ... different MFRC522 RFID modules and on the right is the time of punching in Note If the personâA Z s name is written to the MFRC522 RFID Module in advance and then the id is replaced with text in the code which will be mentioned later in the code explanation so that the attendance sheet records the name of each person rather than the ID of the card 118 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 123: ...xt reader read print ID s nText s id text GPIO output RedPin GPIO LOW GPIO output GreenPin GPIO HIGH First we set attendance to False which means that no one is clocked in Then set GreenPin to low level to light it and RedPin to high level to keep it off indicating that the current attendance system is working normally When someone punches in the id and text information of the card will be printed...

Page 124: ...s for extending the 40 pins of the Raspberry Pi inside the RasPad to the external breadboard SunFounder has a very complete course system about Raspberry Pi GPIO learning kits such as the following two learning kits Electronic Kit for Raspberry Pi and Arduino This basic learning kit is suitable for the Raspberry Pi and Arduino novice This kit teaches basic circuit design and introduces Python prog...

Page 125: ... https www amazon ca dp product B07KH2C215 7 7 Scratch Projects In this chapter you will learn to use Scratch on RasPad 3 which includes 10 examples If you are a user who has just used Scratch we recommend that you try the teaching examples in order so that you can quickly get started with Scratch If the Raspberry Pi system you downloaded comes with recommended software you can find Scratch 3 in P...

Page 126: ... in the name they will become active Click the green flag to start Or click Animate A Name and then learn online tutorial on the Scratch official website Required Components A RasPad 3 Scratch 3 eitherÂa onlineÂa orÂa offline You Will Learn Choose the sprite you want Program different sprites separately Make the sprite change color Let the sprite spin Let the sprite zoom Let the sprite flash Lesso...

Page 127: ...SunFounder RasPad 3 First delete the original sprite we donâA Z t need it Then choose a sprite 7 7 Scratch Projects 123 ...

Page 128: ...SunFounder RasPad 3 Find the Letter sprite Repeat several times to spell out your name like me âA IJAbbyâA I 124 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 129: ...SunFounder RasPad 3 7 7 Scratch Projects 125 ...

Page 130: ...f code for it When A is clicked it changes its color Click on the sprite find ãA N when this sprite clikedãA in Events and drag it to the right coding area Drag ãA N change color effect byâA eãA from Looks to the bottom of ãA N when this sprite clikedãA 126 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 131: ... on the letter A on the stage and it will change its color B can rotate 360Âr Click on the Glow B sprite letâA Z s write a code for the Glow B wizard When the letter B on the stage is clicked it will rotate in a circle 7 7 Scratch Projects 127 ...

Page 132: ... times Because 24 15 360 it turns 360 degrees B2 can zoom in and out Click on the Glow B2 sprite and let us write a code for the Glow B2 sprite When the second B on the stage is clicked it will zoom in and then zoom out 128 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 133: ...asPad 3 Y can show and disappear Click on the Glow Y sprite and let us write a piece of code for the Glow Y sprite When the Y on the stage is clicked it will repeatedly disappear and appear 7 7 Scratch Projects 129 ...

Page 134: ...om and rotate when clicked 7 7 2 Create a Story Description Do you like to hear stories For example before going to bed you can have a sweet dream at night by listening to a little story from your parents Today we are going to âA IJtellâA I the story of a little monkey looking for a banana on Scratch Click the green flag to start Or click Create a Story and then learn online tutorial on the Scratc...

Page 135: ...son Guide This is a happy Monkey named Harley In the lower right corner of the Scratch there are two areas the character area and the stage area where we can add the sprites and stage we want First the current sprite and then click the Choose a Sprite button to add the sprite Here we need to find Monkey click on it You can use the search box above to find it Here we give it a name Harley 7 7 Scrat...

Page 136: ... is hungry He asked his friend Perry where is the banana Click on your Harley sprite and then click on the Event category Drag ãA N when âŽS clickedãA to the coding area on the right 132 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 137: ...SunFounder RasPad 3 Click on the Looks category and drag ãA N say âA IJHello âA I for 2 secondãA to the bottom of âA IJwhen âŽS clickedâA I 7 7 Scratch Projects 133 ...

Page 138: ...sPad 3 Change what it says and how long it says in the input box Perry had seen bananas in the park so he told Harley Perry is a Frog add Frog sprite and Forest backdrop 134 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 139: ...SunFounder RasPad 3 Click on the Frog sprite add a 3 second ãA N delayãA block wait for Harley to finish speaking and then it speaks 7 7 Scratch Projects 135 ...

Page 140: ...e park and found bananas on the table Now click on the Backdrop and let it switch after 6 seconds after the conversation ends Now by clicking on the green flag we can see that the Perry and Harley âA IJcomeâA I to the park together after the conversation 136 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 141: ...here should be bananas on the table So we have to make Perry âA IJdisappearâA I Click on the Frog sprite add an event ãA N when backdrop switches toâA eãA and find âA IJhideâA I and âA IJshowâA I in Looks Let the Perry appear at the right time 7 7 Scratch Projects 137 ...

Page 142: ...SunFounder RasPad 3 Add the Banana sprite and adjust the angle 138 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 143: ...SunFounder RasPad 3 Also let it appear at the right time 7 7 Scratch Projects 139 ...

Page 144: ...escription Everyone has been to the concert hall It is filled with a dazzling array of musical instruments These musical instruments make wonderful sounds under the performance of musicians Today we will also be a musician and add some musical instruments on the stage of Scratch When you click on different instruments they will emit corresponding instrument sounds Click the green flag to start Or ...

Page 145: ...sprite Let the sprites do some actions Lesson Guide We Need the Drums Click on the âA IJAdd ExtensionâA I icon at the bottom left of Scratch select Music and then you will find a new extension Music on the left side of Scratch Delete the original sprite add Drum highhat sprite and Drum snare sprite Adjust the Drum highhat sprite and Drum snare sprite to the appropriate size 7 7 Scratch Projects 14...

Page 146: ...SunFounder RasPad 3 142 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 147: ...hhat sprite and drag out the ãA N play drumâA eãA block in the Music expansion module Change the option to 5 Open Hi Hat then use the âA IJnext costumeâA I block to switch the appearance of Drum highhat Now you can play the Drum highhat 7 7 Scratch Projects 143 ...

Page 148: ...te and drag out the ãA N play drumâA eãA block in the Music expansion module Change the option to 1 Snare Drum then use the âA IJnext costumeâA I block to switch the appearance of Drum snare Now you can play theDrum snare 144 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 149: ...00 3 Side Stick Drum Kit 150 2 Bass Drum Drum cymbal 200 4 Crash Cymbal 7 7 4 Clicker Game Description Today we will play a game of poking balloons Click the green flag to start Or click Clicker Game and then learn online tutorial on the Scratch official website Required Components A RasPad 3 Scratch 3 eitherÂa onlineÂa orÂa offline You Will Learn Pick random number Change the position size and co...

Page 150: ...SunFounder RasPad 3 Set the balloon to a random position 146 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 151: ...SunFounder RasPad 3 Let it change the color and size randomly 7 7 Scratch Projects 147 ...

Page 152: ...ick on the balloon to add score Now we need to establish a scoring mechanism Whenever the balloon is clicked the score will increase by one Create a variable it can help us keep track of and store the score In Variables select ãA N Make a VariableãA and named score 148 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 153: ...d 3 We will see it in the upper left corner of the stage When the balloon is clicked the score is increased by one When you click the green flag the game starts the score will be reset to zero 7 7 Scratch Projects 149 ...

Page 154: ... you will lose score 7 7 5 Shooting Game Description Have you seen those shooting games on TV The closer a contestant shoots a bullet on the target to the bullseye the higher his score Today we are also doing a shooting game in Scratch In the game let the Crosshair shoot as far as possible to the bullseye to get a higher score Click on the green flag to start Use the space bar to shoot an bullet O...

Page 155: ...r Lesson Guide Arrange the Crosshair and targets First delete the previous sprite upload the Crosshair sprite and the target background you can find them under the path raspad3 scratch materials You have downloaded from raspad3 git before Click the icon below the sprite list select âA IJUpload Sprite OptionâA I find the Cross Hair svg file and upload it Similarly upload the backdrop Target jpg 7 7...

Page 156: ...SunFounder RasPad 3 152 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 157: ...SunFounder RasPad 3 7 7 Scratch Projects 153 ...

Page 158: ... take aim When aiming the Crosshair will slightly shake we are now going to use the ãA N glideâA eãA block to achieve this effect Set the random position and size of the Crosshair sprite 154 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 159: ...come more stable Or is it more swaying LetâA Z s shoot We are now going to express the effect of shooting bullets how is it Stop the crosshair moving and then let it shrink quickly to create a shooting effect This means that when the space bar is pressed we need to stop shaking the code of the Crosshair and keep the size of the Crosshair sprite shrinking 7 7 Scratch Projects 155 ...

Page 160: ...different color circles will get different scores The closer to the bullseye the higher the score For example a shot in the red area can score 200 points LetâA Z s use the ãA N Touching ColorãA block to judge This block has a color picker and we use it to pick up the red color on the target 156 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 161: ...SunFounder RasPad 3 Use the same method to set corresponding scores for different color circles 7 7 Scratch Projects 157 ...

Page 162: ...SunFounder RasPad 3 158 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 163: ...e scratch stage to simulate an underwater world and then add the Star sprite and fish sprite to make a âA IJhit the magic fishâA I mini game Click on the green flag to Start Press the space bar to launch the Starfish Or click Hit the magic fish and then learn online tutorial on the Scratch official website Required Components A RasPad 3 Scratch 3 eitherÂa onlineÂa orÂa offline You Will Learn Let t...

Page 164: ...s 240 120 and then let it swim left and right Use the ãA N if on edge bounceãA block to make the Fish sprite fold back from the edge When it hits the wall it will fold back in the opposite direction to the original 160 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 165: ...Let the Star appear at 0 120 If we press the â ER or key on the keyboard it will go left and right We use the ãA N key âA e pressedãA block to determine the keyboard and use ãA N change x by âA eãA to move the sprite 7 7 Scratch Projects 161 ...

Page 166: ...SunFounder RasPad 3 Next launch the Star If the space bar is pressed the y coordinate value of the Star sprite will increase and the Star sprite will rise 162 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 167: ...SunFounder RasPad 3 Something is wrong The Star sprite should continue to rise until it reaches the height of the Fish sprite remember 7 7 Scratch Projects 163 ...

Page 168: ...ne whether it hits the Fish When the Star sprite hits the Fish sprite we need to tell the Fish sprite about this and let it do the corresponding behavior change its shape We set up a âA IJHitâA I broadcast This broadcast will tell the entire program that something called âA IJHitâA I has happened All sprite and even the backdrop can hear this broadcast and respond accordingly 164 Chapter 7 RASPAD ...

Page 169: ...asPad 3 Back to the programming interface of the Fish sprite use a ãA N when I receiveâA eãA block to receive the âA IJHitâA I broadcast and then use ãA N Next costumeãA to change your form 7 7 Scratch Projects 165 ...

Page 170: ... Note This does not involve the calculation of sprites and backdrops We tend to put such codes in backdrops Countdown Add a time mechanism When the green flag is clicked the timer is set to 30s and then decreases by 1 every second until the event is reset to zero to end the game But if you hear the âA IJHitâA I broadcast let the timer increase by one to increase the game time 166 Chapter 7 RASPAD ...

Page 171: ...ion Do you understand binary numbers binary is a number system widely used in computing technology so understand ing binary numbers is an important step for understanding the computer world Click on the green flag to start A random number will appear in the middle of the screen and you need to know the corresponding binary number For example 5 the corresponding Binary number should be 0101 press t...

Page 172: ...small binary abacus at the bottom of the screen First we delete the previous sprite Upload the Zero png file and Enter png file in the sprite list you have downloaded them from raspad3 git before Then we upload the One png file in the Costumes option of the Zero sprite so that the Zero sprite has Zero costume and One costume Then we copy the Zero sprite with the right mouse button and there will b...

Page 173: ... IJnum3âA I and âA IJnum4âA I respectively and initialize the positions of the four sprites The program in the figure below is the program of the Zero sprite The other three Zero sprites modify the variable names and increase the X coordinate by 80 to make the effect arranged in order from left to right 7 7 Scratch Projects 169 ...

Page 174: ...SunFounder RasPad 3 When we click the âL Ž sign in front of the variable the variable will disappear from the stage 170 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 175: ...SunFounder RasPad 3 7 7 Scratch Projects 171 ...

Page 176: ...rite switches costume Copy the program for the remaining three Zero sprites and modify the variable names Conversion of binary numbers and decimal numbers Before programming the Enter sprite letâA Z s first understand the Binary number A binary number is a number expressed in the base 2 numeral system or binary numeral system which uses only two symbols typically âA IJ0âA I zero and âA IJ1âA I one...

Page 177: ... decimal number of 1010 1 2 3 0 2 2 1 2 1 0 2 0 10 Programming the Backdrop When the game starts a random integer between 1 16 appears in the middle of our screen as a decimal number that needs to be converted by binary and it is stored in the variable random Whether we receive a âA IJrightâA I result or a âA IJwrongâA I result we have to regenerate the random number and proceed to the next round ...

Page 178: ...sprite is clicked We convert the binary number composed of the num1 variable num2 variable num3 variable and num4 variable into a decimal number and save the result in the result variable Then use the result variable to compare the value of the random variable If they are equal we broadcast a âA IJrightâA I message otherwise we broadcast a âA IJwrongâA I message 174 Chapter 7 RASPAD PROJECTS AND A...

Page 179: ...ro sprite to convert random integers between 1 32 When you click on the Zero sprite a âA IJPopâA I sound effect will be emitted 1 point will be deducted for incorrect answers 7 7 8 Flappy Parrot Description Today we made the parrot Devin avoid the trees for food Click on the green flag to start Or click Flappy Parrot and then learn online tutorial on the Scratch official website Required Component...

Page 180: ...kground image First we delete the default sprites and add Parrot sprites and Blue Sky backdrop Change the size of the Parrot sprite to 20 Upload the Trees sprite select the Upload Sprite option find the âA IJTrees pngâA I file and upload it Click Costumes and then click the âA IJUpload CostumeâA I option to upload Trees2 png Trees3 png Trees4 png and Trees5 png 176 Chapter 7 RASPAD PROJECTS AND AC...

Page 181: ...SunFounder RasPad 3 Copy out the second Trees 7 7 Scratch Projects 177 ...

Page 182: ...SunFounder RasPad 3 178 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 183: ...ying on the stage Set the initial position and movement of the Trees sprite so that it can reach the far left from the far right of the stage Then randomly changing costumes reappear on the far right side of the stage The code of the Trees2 sprite is almost the same as the Trees sprite the only difference is that it hides for 1 5 seconds at the beginning 7 7 Scratch Projects 179 ...

Page 184: ...Founder RasPad 3 Now click on the green flag to see the effect of this flightâA e Very good the Parrot sprite seems to be flying to the right side of the stage 180 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 185: ...e button control Parrot to fly When the game starts Parrot will continue to drop down that is the y coordinate will continue to decrease When we press the space button the y coordinate of Parrot will increase 7 7 Scratch Projects 181 ...

Page 186: ...nder RasPad 3 Constantly increase the speed of Parrot falling through variables Parrot drop is a bit slow we add flight variables to make Parrot drop more and more 182 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 187: ...SunFounder RasPad 3 Change the costume so that Parrot has flight animation When we press the Space button ParrotâA Z s clothing switches to Parrot b 7 7 Scratch Projects 183 ...

Page 188: ...SunFounder RasPad 3 184 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 189: ...ve to the right side of the Parrot sprite it means that Parrot has crossed the Trees and Trees2 At this time we will add score 1 In order to avoid always adding points we need to add it after score 1 Wait 1 second for the code This code is required in both Trees and Trees2 sprites 7 7 Scratch Projects 185 ...

Page 190: ... content When the game fails it switches to a cursing background screen Add a countdown screen to the game start screen let us prepare for the game 7 7 9 Paint Box Description Have you ever had a Paint Box You can use the colorful brushes in the Paint Box to paint a colorful world Today we are also making an exclusive Paint Box on scratch LetâA Z s take action Click on the green flag to start Or c...

Page 191: ...the location of the cursor Use the slider to modify the value of the variable Lesson Guide Lay out the drawing board add Pen expansion function First we delete the previous sprite and then add the Pencil sprite and Block X sprite to Scratch Upload Eraser svg Red png Blue png Green png Yellow png and other files in the Sprite list You have down loaded from raspad3 git before and finally set the siz...

Page 192: ...SunFounder RasPad 3 Then we add the Pen extension function 188 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 193: ...ite First we need to make the Pencil sprite move with the mouse If the mouse button is pressed we call the ãA N pen downãA block in the Pen extension function which can draw along the track of the cursor Otherwise call theãA N pen upãA block to stop drawing 7 7 Scratch Projects 189 ...

Page 194: ...ad 3 Click on the green flag and try to control the Pencil sprite with the mouse to draw a smiley face You will find that the image is not drawn from the tip of the Pencil 190 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 195: ...encil sprite and move it until the Pencil tip is aligned with the cross cursor Let the Pencil sprite change the painting color How to achieve that when we click on the color option below the stage the Pencil sprite will switch the corresponding color First we write code for the Red sprite when it is clicked we broadcast a new âA IJredâA I message 7 7 Scratch Projects 191 ...

Page 196: ... sprite and when it receives the âA IJredâA I message we change the color of the Pencil to red In the same way we also write code for the Blue sprite and when it is clicked we broadcast a new âA IJblueâA I message 192 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 197: ...on of clear drawing image Sometimes accidents happen when we draw so we need to add a clear function First select the Block X sprite when it is clicked we clear all the screens Next we set a new costume for the Pencil sprite click the âA IJCostumesâA I tab and then select the Upload Costume option from the icon on the bottom left to upload the Eraser svg file Modify the size of the Eraser garment ...

Page 198: ...n it receives the âA IJeraserâA I message it will change to the Eraser costume so that when we click on the Eraser sprite we can change the Pencil spriteâA Z s costume to look like an Eraser sprite Then change the color to white that is consistent with the background color of the stage so as to achieve the function of partial removal 194 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 199: ... switched to Eraser we need to switch the costume of the Pencil sprite to the Pencil a costume by clicking the red and blue on the drawing board so when we receive the âA IJredâA I message and the âA IJblueâA I message We want to switch back to the original Pencil a costume 7 7 Scratch Projects 195 ...

Page 200: ... the width of the Pencil at any time Create a new variable named âA IJwidthâA I then right click the âA IJwidthâA I variable on the stage select slider and then you will see a slider on the stage that can change the value of the âA IJwidthâA I variable 196 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 201: ...SunFounder RasPad 3 Use the value of the variable âA IJwidthâA I as the size of the Pencil 7 7 Scratch Projects 197 ...

Page 202: ...SunFounder RasPad 3 198 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 203: ... Pencil Only when the Pencil enters the drawing area can painting be allowed When the pen enters the toolbar that is when the y coordinate is less than or equal to 120 we need to call the ãA N pen upãA function to stop painting 7 7 Scratch Projects 199 ...

Page 204: ...SunFounder RasPad 3 200 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 205: ... banana game In the stipulated time help the Monkey eat more bananas To play the game against a white background click on the green flag to start Move colored objects in front of the camera to control the Monkey sprite Or click Eating Banana Game and then learn online tutorial on the Scratch official website Required Components A Raspad Scratch 3 eitherÂa onlineÂa orÂa offline You Will Learn Insta...

Page 206: ...d 3 Click the âA IJAdd ExtensionâA I icon at the bottom left of scratch and select the Video Sensing extension At this point you can see the camera shot on the Scratch stage 202 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 207: ...Bananas sprite and change their sizes to 50 Let Bananas appear randomly Bananas disappears after encountering the Monkey which means it was eaten by the Monkey and reappears randomly Let the Monkey appear in the center of the stage and initialize the camera data transparency is set to 20 7 7 Scratch Projects 203 ...

Page 208: ...move towards the object Now click on the green flag at the top of the stage area to start the game Let the Monkey eat bananas it is very hungry Try to play this game on a white background to prevent interference from other objects 204 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 209: ... who has the highest score When Monkey eats a banana it emits a suitable sound effect 7 7 11 Create Musical Instrument Description You can turn RasPad 3 into a game screen playing with your friends a smart alarm showing the weather and time a display monitoring your robotâA Z s action and many other things This article will show you how to DIY a Musical Instrument with your RasPad 3 LetâA Z s take...

Page 210: ...d 3 Required Components A RasPad 3 8G SD Card Scratch 3 eitherÂa onlineÂa orÂa offline Micro SD Card Reader 40 Pin Ribbon Cable T Type GPIO Extension Board Breadboard Button 206 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 211: ...n Scratch Input the button value from the GPIO pins Lesson Guide Build the Circuit First connect the GPIO Extension Board please read GPIO Extension Board for specific steps Insert the T type GPIO extension board into the breadboard and build the circuit as shown below 7 7 Scratch Projects 207 ...

Page 212: ...rd slot is set on the back cover and itâA Z s in snap style Therefore before opening or closing the back cover you need to take out the microSD card to avoid damaging your microSD card and the internal button board On the left of Scratch 3 main page are some neatly arranged blocks with which you can drag to program In this 208 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 213: ...tion to play instruments and drums and the Raspberry Pi GPIO function can be used to control the whole pins of Raspberry Pi Tap Add icon at lower left corner and choose Music and Raspberry Pi GPIO to add two functions on the left of the main page of the Scratch 3 Finished the program 7 7 Scratch Projects 209 ...

Page 214: ...SunFounder RasPad 3 Press these three buttons on the breadboard and there emits the tones âA IJDo Re MiâA I 210 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 215: ...rument for example you can add more buttons notes and an LED to make a cool music box 7 7 12 DIY RasPad Monitor Device Description You can turn RasPad3 into a game screen playing with your friends a smart alarm showing the weather and time a display monitoring your robotâA Z s action and many other things This article will show you how to DIY a RasPad Monitor Device on your RasPad 3 LetâA Z s take...

Page 216: ...nts A RasPad 3 8G SD Card Scratch 3 eitherÂa onlineÂa orÂa offline Micro SD Card Reader 40P Ribbon Cable T Type GPIO Extension Board Breadboard PIR Module Camera Module FFC Cable Jump Wire F M 212 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 217: ...h Use audio functions on Scratch Use PIR module Lesson Guide Build the Circuit First connect the GPIO Extension Board please read GPIO Extension Board for specific steps Plug the T type GPIO extension board into the breadboard and build the circuit 7 7 Scratch Projects 213 ...

Page 218: ...SunFounder RasPad 3 For the camera installation tutorial please refer to Assemble the Camera Module 214 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 219: ...oundsâA I option on the left upper cornerïijN then tap the âA IJspeakerâA I icon and choose âA IJUpload SoundâA I icon to upload the prepared music file hello finally tapâA IJOpenâA I to confirm Tap Add icon at lower left corner and chooseâA IJVideo SensingâA I andâA IJRaspberry Pi GPIOâA I to add two func tions 7 7 Scratch Projects 215 ...

Page 220: ...nction and a âA IJplay sound hello until doneâA I to the coding area Stick the pir module and camera to the wall outside the door And stick the RasPad to the wall inside the door or anywhere When the door is opened you will hear music and then see who is there 216 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 221: ...g system that we used before RasPad 3 also supports other operating systems Here we only provide a link for learning reference You can try it again according to the operation steps above the link Note We have only tested Raspberry Pi OS Ubuntu MATE RetroPie on RasPad If you have other systems installed but some of them may have some bugs that make some of the functions unusable we can only suggest...

Page 222: ...SunFounder RasPad 3 218 Chapter 7 RASPAD PROJECTS AND ACTIVITIES ...

Page 223: ...FC cable to the CSI interface of the Camera Module Carefully pass the CSI interface cable through the slot on the back cover of the RasPad Connect the CSI interface of the Raspberry Pi Then carefully close the back cover of the RasPad Warning The SD card slot is a snap in style attached to the back cover Before removing or replacing the back cover remove the micro SD card to avoid damaging the mic...

Page 224: ...SunFounder RasPad 3 Insert the micro SD card with the Raspberry Pi OS image into the slot and long press the power button to boot the RasPad Open Raspberry Pi Configuration 220 Chapter 8 APPENDIX ...

Page 225: ...SunFounder RasPad 3 In the Interfaces option Enable the Camera and then click OK 8 1 Assemble the Camera Module 221 ...

Page 226: ...estart is complete use the following command line to check whether the camera is available If the camera screen appears it means that the camera is installed successfully Otherwise the FFC cable needs to be unplugged and plugged in again raspivid o vid h264 222 Chapter 8 APPENDIX ...

Page 227: ...m They are wiringPi BCM and Board Among these naming conventions the 40 pin GPIO Extension board uses the naming convention BCM The following table shows the naming convention for WiringPi Board and the intrinsic Name of each pin on GPIO Extension board For example for the GPIO17 the Board naming method of it is 11 the wiringPi naming method is 0 and the intrinsic naming method of it is GPIO0 8 2 ...

Page 228: ... ribbon cable through the available slot on the base of the RasPad and connect the other end of the 40 pin ribbon cable to the GPIO extension board Then replace the back cover of the RasPad Warning The SD card slot is a snap in style attached to the back cover Before removing or replacing the back 224 Chapter 8 APPENDIX ...

Page 229: ...ower Adapter 1 Micro SD card 1 Screen Power Adapter 1 HDMI cable 1 Screen 1 Mouse 1 Keyboard 1 Insert the micro SD card with the Raspberry Pi OS image into the micro SD card slot on the underside of the Raspberry Pi 2 Plug in the Mouse and Keyboard 3 Connect the screen to the Raspberry PiâA Z s HDMI port Make sure the screen is plugged into a wall socket and turned on Note For the Raspberry Pi 4 m...

Page 230: ...ss and two of them are listed as follows 1 Checking via the router Check the addresses assigned to Raspberry Pi on the administration interface of the router The default hostname of the Raspberry Pi OS is raspberrypi If you are using an ArchLinuxARM system please find alarmpi 2 Network Segment Scanning Network scanning applications can be used to look up the IP address of Raspberry Pi such as Adva...

Page 231: ...anguage that acts as a bridge linking the customers and Unix Linux systems For Linux or Mac OS X Users Go to Applications Utilities find the Terminal and open it Type in ssh pi ip_address where pi is the username and ip_address is the IP address of the Raspberry Pi For example ssh pi 192 168 18 197 At the prompt type yes in lowercase The default password is raspberry 8 4 Use the SSH Remote Control...

Page 232: ...spberry Pi connected and are ready to go to the next step For Windows Users Windows users can use SSH with the PuTTY application Download PuTTY open the application and click Session on the left of the tree like structure Enter the IP address of the Raspberry Pi in the text box under Host Name and enter 22 under Port 228 Chapter 8 APPENDIX ...

Page 233: ...ill be a security prompt Click Yes to continue When the PuTTY window prompts login as type in pi for the user name of the Raspberry Pi The default password is raspberry Note The characters do not display when typing in the password Make sure to input the correct password 8 4 Use the SSH Remote Control 229 ...

Page 234: ...SunFounder RasPad 3 Here we get the Raspberry Pi connected and it is time to conduct the next steps 230 Chapter 8 APPENDIX ...

Page 235: ...Raspberry Pi OS 4 Try a different microSD card 9 2 CanâA Z t detect Micro SD card 1 Whether the FFC on the Micro SD card board is connected correctly refer to ASSEMBLY INSTRUCTIONS 2 Check whether the golden finger transmission signal on the SD card or the Micro SD card board turn black If it is it means that the gold finger has been oxidized and you need to erase the oxide layer with an eraser 3 ...

Page 236: ...sPad is not shut down it will automatically go to sleep after a period of time because it does not detect the HDMI signal You need to long press the RasPadâA Z s power button to shut down If you directly press and hold the power button of RasPad both Raspberry Pi and RasPad will be turned off at the same time But it should be noted that this is to turn off the power of the Raspberry Pi directly wh...

Page 237: ...rsion of RasPad 3 because the touch will become very strange after an external display so turn off the touch function B Touch inaccurate Because the Raspberry Pi system is based on the PC mouse control the human hand can not be as accurate as the mouse if the touch accuracy problems cause inconvenience we recommend that you increase the size of the icon or use the RASPAD LAUNCHER to install RasPad...

Page 238: ...âA Z s 28 65Wh But because the Raspberry Pi itself is relatively large power consumption standby about 3W and the Raspberry Pi system is not similar to the power saving mechanism of the tablet or even iOS Compared to the previous generation we have reduced the original 7w screen drive power consumption to 3W or less and the use of time has been improved We will continue to optimize this use of tim...

Page 239: ...it for personal study investigation enjoyment or other non commercial or nonprofit purposes under therelated regulations and copyrights laws without infringing the legal rights of the author and relevant right holders For any individual or organization that uses these for commercial profit without permission the Company reserves the right to take legal action 235 ...

Reviews: