background image

SunFounder TS-10 10.1-inch Touch Screen

Step3

Insert the two 2.5*22 standoffs into the holes on the back to keep the screen balanced.

15

Summary of Contents for TS-10

Page 1: ...SunFounder TS 10 10 1 inch Touch Screen www sunfounder com Nov 19 2021 ...

Page 2: ......

Page 3: ...ame System Installation 37 5 2 4 RetroPie Configuration 40 5 3 3D Printer Monitor 41 5 3 1 Touch UI 42 5 3 2 Make a 3D Model 42 5 3 3 Print 3D Model 48 5 3 4 Video 52 5 4 Home Assistant 52 5 4 1 Install Home Assistant 52 5 4 2 Install and configure ESPHome 54 5 4 3 Log In 62 5 4 4 Add Smart Devices 67 5 4 5 Add DIY Device with ESP32 71 5 4 6 Start the Home Assistant Service at Boot 75 5 4 7 Enter ...

Page 4: ...e Magic Fish 138 5 7 7 Binary Game 146 5 7 8 Flappy Parrot 154 5 7 9 Paint Box 165 5 7 10 Eating Banana Game 180 5 7 11 Create Musical Instrument 183 5 7 12 DIY Monitor Device 188 5 8 Install Other Systems on Raspberry Pi 192 6 APPENDIX 193 6 1 Assemble the Camera Module 193 6 2 GPIO Extension Board 195 6 3 Obtain the IP Address of the Raspberry Pi 197 6 4 Use the SSH Remote Control 198 7 3D PRINT...

Page 5: ...ouch 10 point Touch Screen SunFounder TS 10 10 1 inch Touch Screen is a 10 point capacitive touch screen with a resolution of 1280x800 bringing you perfect visual experience It works with various operating systems including Raspbian Ubuntu Ubuntu Mate Windows Android and Chrome OS you may need an USB extension cable CONTENTS 1 ...

Page 6: ...SunFounder TS 10 10 1 inch Touch Screen 2 CONTENTS ...

Page 7: ...e it lights on continuously and the red LED lights on immediately If there s no HDMI signal only the red LED will turn on If there s an HDMI signal these two LEDs will turn on If you press the power button the green LED will turn off and the red LED will keep turning on If you remove the power cord both of the two LEDs will turn off Buttons Buttons on the main board and their functions 3 ...

Page 8: ... press to power ON OFF the de vice Raspberry Pi B Increase screen brightness B Reduce screen brightness V Volume up V Volume down On one side of the main board there are ports of HDMI input 12V power input and 5V 3A USB power output Also equipped with a 4pin PH2 0 speaker connector 4 Chapter 1 HARDWARE DESCRIPTION ...

Page 9: ...SunFounder TS 10 10 1 inch Touch Screen 5 ...

Page 10: ...SunFounder TS 10 10 1 inch Touch Screen 6 Chapter 1 HARDWARE DESCRIPTION ...

Page 11: ...to the Raspberry Pi Imager site and download the version that matches the computer or laptop s operating system www raspberrypi org software When the download is complete launch the installer program and follow the prompts to install the Raspberry Pi Imager If the Windows operating system prevents the application from launching click on More info and then click on Run anyway to install the Raspber...

Page 12: ...8 version which may cause some functions to be unavailable Please do not use the latest version for now Select the SD card you are using Press Ctrl Shift X to open the Advanced options page to enable SSH and configure wifi these 2 items must be set the others depend on your choice You can choose to always use this image customization options 8 Chapter 2 INSTALL THE RASPBERRY PI OS ...

Page 13: ...i settings and then click SAVE Note The entry for the WiFi country should be set to a designated two letter ISO IEC alpha2 code designated to the country Please reference the following link https en wikipedia org wiki ISO_3166 1_alpha 2 Officially_assigned_ code_elements 9 ...

Page 14: ...will overwrite any 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 10 Chapter 2 INSTALL THE RASPBERRY PI OS ...

Page 15: ...SunFounder TS 10 10 1 inch Touch Screen Now insert the Micro SD card with the system installed into the Raspberry Pi 11 ...

Page 16: ...SunFounder TS 10 10 1 inch Touch Screen 12 Chapter 2 INSTALL THE RASPBERRY PI OS ...

Page 17: ... one on the back of the screen so you can fix boards with different sizes by moving the nuts and 2 5 6 standoffs with the small wrench Step2 If you want to use a Raspberry Pi with the screen then you don t need to adjust the standoffs since they are preset for it Just place the Raspberry Pi on the plate and fasten them with 2 5 14 4 standoffs 13 ...

Page 18: ...SunFounder TS 10 10 1 inch Touch Screen Of course you also adjust the position of the standoffs to mount other boards 14 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 19: ...SunFounder TS 10 10 1 inch Touch Screen Step3 Insert the two 2 5 22 standoffs into the holes on the back to keep the screen balanced 15 ...

Page 20: ...Connect the HDMI port of the Raspberry Pi and the screen via an HDMI cable Note In this kit 2 types of HDMI cables and 2 types of power cords of Raspberry Pi are provided for Raspberry Pi 3 and Raspberry Pi 4 Pi 4 16 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 21: ...SunFounder TS 10 10 1 inch Touch Screen pi 3 Step 5 17 ...

Page 22: ...SunFounder TS 10 10 1 inch Touch Screen Connect the power port of the Raspberry Pi to the USB port of the main board via a USB cable Pi 4 Pi 3 18 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 23: ...pin USB cable To prevent the cable from falling off use tape to fix it Note In the following assembly steps the method of Raspberry Pi 3 is the same as that of Raspberry Pi 4 so we take Raspberry Pi 4 as an example to introduce Step 7 Connect the power cable of the supply to power the main board of the screen 19 ...

Page 24: ...SunFounder TS 10 10 1 inch Touch Screen Step 8 Then power it on and the boot screen will appear 20 Chapter 3 ASSEMBLY INSTRUCTIONS ...

Page 25: ...rd rate when 1024x600 is not included you need to set the aspect ratio close to 16 9 and add the following lines below hdmi_force_hotplug 1 hdmi_cvt 1024 600 60 3 0 0 0 hdmi_cvt width height framerate aspect margins interlace value Default Description width required width in pixels height required height in pixels framerate required framerate in Hz aspect 3 aspect ratio 1 4 3 2 14 9 3 16 9 4 5 4 5...

Page 26: ...ebsite https www raspberrypi org documentation configuration config txt md Step 3 Reboot Raspberry Pi Reboot the Raspberry pi with the command sudo reboot sudo reboot For Raspberry Pi 4 1 Click the Raspberry Pi icon Preferences Screen Configuration 2 Then choose Configure Screens HDMI 1 Resolution choose the resolution that you want 22 Chapter 4 QUICK USER GUIDE ...

Page 27: ...SunFounder TS 10 10 1 inch Touch Screen 3 After that you need to click the tick icon to save your configure 4 1 Adjust the Resolution 23 ...

Page 28: ...ng 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 following 2 items When you check Automatically display when editing text you will be prompted to reboot you can rebo...

Page 29: ...SunFounder TS 10 10 1 inch Touch Screen 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 25 ...

Page 30: ...ch Screen 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 26 Chapter 4 QUICK USER GUIDE ...

Page 31: ... 10 1 inch Touch Screen After the setting is complete restart the Raspberry Pi Every time you restart this screen you need to click General Access Onboard to enable the virtual keyboard 4 2 Install Virtual Keyboard 27 ...

Page 32: ...SunFounder TS 10 10 1 inch Touch Screen Now you can use this keyboard to edit your files or codes 28 Chapter 4 QUICK USER GUIDE ...

Page 33: ...ght click function 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 ...

Page 34: ...ommand before exit 0 sudo usr local bin evdev rce Press Ctrl C Y to exit and save the rc local file and then run sudo reboot to restart sudo reboot After restarting you can long press on the Raspberry Pi desktop and see if the right click function appears 30 Chapter 4 QUICK USER GUIDE ...

Page 35: ...cts to choose from 5 1 Multimedia Options Watch videos read e books or play games on this screen 5 1 1 Watch Video The Raspberry Pi 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 31 ...

Page 36: ...SunFounder TS 10 10 1 inch Touch Screen 5 1 2 Read E book Read online from the Google Chrome browser 32 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 37: ...10 10 1 inch Touch Screen 5 1 3 Play Game Click Preferences Recommended Software Games to install games on this screen For example install Minecraft and plug in a keyboard and mouse to play 5 1 Multimedia Options 33 ...

Page 38: ...10 1 inch Touch Screen 5 2 Retro Games Console 5 2 1 Description You can turn this screen Raspberry Pi into a retro games console playing with your friends let s see how we can do it 34 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 39: ...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 When playing games a gamepad and a keyboard are needed 5 2 Retro Games Console 35 ...

Page 40: ...Founder TS 10 10 1 inch Touch Screen This screen is a 1280x800 LCD touch screen allowing for high resolution and sound quality to provide an excellent gaming experience 36 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 41: ...ws you to 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 5 2 Retro Games Console 37 ...

Page 42: ...SunFounder TS 10 10 1 inch Touch Screen Installing RetroPie Step 1 Download the SD image compatible with the Raspberry Pi 4 on the RetroPie official website 38 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 43: ...mager Note 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...

Page 44: ...Touch Screen it s another one of our products but the configuration method is the same on the RetroPie 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 t provide ROMs for ...

Page 45: ... user to 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 ...

Page 46: ... autostart 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 Raspberry Pi execute the startTouchUI sh script file on boot home pi startTouchUI sh After restarting the Raspberry Pi the OctoPrint s Touch UI will open...

Page 47: ...timaker Cura 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 5 3 3D Printer Monitor 43 ...

Page 48: ...inch Touch Screen 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 44 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 49: ... the correct 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 5 3 3D Printer Monitor 45 ...

Page 50: ...ura has successfully 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 s library 46 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 51: ... right hand corner 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 file locally Select the type of file extension recognized by the 3D printer then click Save 5 3 3D Printer Monitor 47 ...

Page 52: ...tp 192 168 18 179 temp to log in to OctoPrint Note Before logging in to the OctoPrint s web UI OctoPrint will first need to have been successfully installed on the Raspberry Pi The IP address 192 168 18 179 will need to be replaced with the local IP address of the Raspberry Pi Hover the cursor over the WiFi icon on the Raspberry Pi desktop and the local IP address will be displayed 48 Chapter 5 PR...

Page 53: ...SunFounder TS 10 10 1 inch Touch Screen Now you have entered OctoPrint 5 3 3D Printer Monitor 49 ...

Page 54: ...SunFounder TS 10 10 1 inch Touch Screen Click the Upload option to select the sliced 3D model file 50 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 55: ...e print icon The 3D printer will start to print the 3D model file after the slicing process is complete If you have transferred the sliced file to the Raspberry Pi you can also open the OctoPrint UI in Raspberry Pi to print 5 3 3D Printer Monitor 51 ...

Page 56: ...y brands and can easily implement voice control and automation of the devices You can run Home 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 Expand Viewing Here are some projects made by others that combine Raspberry Pi an...

Page 57: ...eassistant 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 more details please see Install Home Assistant Container Start the Home Assistant Service Afte...

Page 58: ...le just like Home Assistant and creates custom firmware which it installs on your ESP device Devices or sensors added in ESPHome s configuration will automatically show up in Home Assistant s UI Installation 1 Installation dependencies sudo pip3 install cryptography 2 8 2 Install ESPHome you need to install Python and install the console script through pip3 Note Python 3 7 or above is required to ...

Page 59: ...ough http localhost 6052 or http X X X X 6052 replace X X X X with your Raspberry Pi s IP address 2 Create configuration Click on the 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 5 4 Home Assistant 55 ...

Page 60: ...SunFounder TS 10 10 1 inch Touch Screen Select the device type ESP32 for example 56 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 61: ...nter Once added you will see them in the Dashboard of ESPHome Note When it is not the first time to add a device click on the main page follow the prompts to enter the device name WIFI and password select the device type 5 4 Home Assistant 57 ...

Page 62: ...Founder TS 10 10 1 inch Touch Screen 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 58 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 63: ...tocol Currently only 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 sta...

Page 64: ...er 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 60 Chapter 5 ...

Page 65: ...ds for you to choose 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 5 4 Home Assistant 61 ...

Page 66: ...ll need to fill in this IP when you add ESPHome to 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 5 4 3 Log In 1 Please set up a username and password for your Home Assistant 62 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 67: ...SunFounder TS 10 10 1 inch Touch Screen 2 Create a name for your home and select your region 5 4 Home Assistant 63 ...

Page 68: ...SunFounder TS 10 10 1 inch Touch Screen 3 Select the content you want to share to Home Assistant 64 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 69: ...1 inch Touch Screen 4 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 5 4 Home Assistant 65 ...

Page 70: ...enter 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 66 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 71: ... You can also make your DIY device with ESP32 and add it in In this section you will learn how to add your smart devices 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 5 4 Home Assistant 67 ...

Page 72: ...SunFounder TS 10 10 1 inch Touch Screen Now back to home assistant refer to Log In click Configuration in the left column select Intergrations 68 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 73: ...network it will display the corresponding integration which can be eas ily added with just a few clicks If your smart device has not been discovered yet don t worry click the ADD INTEGRATION button at the bottom right and search for your integration in the list 5 4 Home Assistant 69 ...

Page 74: ...creen Each integration may be different in use you can visit Home Assistant Integration for details Return to the Overview page If the device you just added does not appear you need to Edit Dashboard 70 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 75: ... You 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 then click Configuration in the left column and select Intergrations 5 4 Home Assistant 71 ...

Page 76: ...ice on your network 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 t worry you can add it via the ADD INTERGATION button at the bottom right 72 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 77: ...ption to place your esp light in the bedroom kitchen or other area of your choice 4 After clicking Finish you will see it in the list Edit Dashboard 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 5 4 Home Assistant 73 ...

Page 78: ...ch Screen 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 74 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 79: ...ull screen self boot interface 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 ...

Page 80: ... menu select Exit full screen Touch screen Long press the blank space to pop up the menu click the exit button at the top of the screen or select Exit full screen 5 4 8 Home Assistant File Structure Homeassistant creates a configuration file by default under the path of the executing user created homeassistant at the homeassistant path The file directory structure is as follows 76 Chapter 5 PROJEC...

Page 81: ...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 5 5 Cloud4RPi Cloud4RPi is a cloud based control panel for IoT projects Cloud4RPi uses dashboard widgets to control IoT devices remotely and show real time device data 5 5 1 Quick Guide on Cloud4RPi 5 5 Cloud4RPi 77...

Page 82: ...thon3 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 this link https cloud4rpi io Before using it you need to register and log in to your Cloud4RPi accou...

Page 83: ...er 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 Open the terminal of the Raspberry Pi and download the test examples provided by Cloud4RPi cd home pi git clone https github com cloud4rpi cloud4rpi raspberrypi python git Use a text editor such as Nano to modify the content of the control py file cd cloud4...

Page 84: ...age If your Raspberry Pi is connected to Cloud4RPi the device information will turn green Using the Cloud4RPi Control Panels The control panel on the Cloud4RPi server provides many useful widgets for IoT applications These widgets can be used to control the conponents or display sensor data After entering Control Panels click the New Control Panel button Note Always run the control py file before ...

Page 85: ...SunFounder TS 10 10 1 inch Touch Screen Before clicking the Add Widget button again you need to select the appropriate widget and the variable to be dis played 5 5 Cloud4RPi 81 ...

Page 86: ...SunFounder TS 10 10 1 inch Touch Screen For example we select the Text widget and then select Hot Water C so that we can see it on the newly created control panel 82 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 87: ...t a device token for each 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 a...

Page 88: ...umidity 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 used...

Page 89: ...nd then display them on Cloud4RPi 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 cli...

Page 90: ...SunFounder TS 10 10 1 inch Touch Screen Select a Chart widget with both Room Temp and CPU Temp as the variables to be displayed 86 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 91: ...10 10 1 inch Touch Screen 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 5 5 Cloud4RPi 87 ...

Page 92: ...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 88 Chapter ...

Page 93: ...ct that can be recognized by the web page Remote Switch In this project we will learn to use Cloud4RPi s Switch to control the relay thereby controlling the relay 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...

Page 94: ...0 1 inch Touch Screen 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 90 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 95: ...of the 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 fu...

Page 96: ... 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 92 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 97: ...SunFounder TS 10 10 1 inch Touch Screen Once added you can use the Slider widget to control the brightness of the LED 5 5 Cloud4RPi 93 ...

Page 98: ...l 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 Raspber...

Page 99: ...berrypi python sudo nano 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 5 5 Cloud4RPi 95 ...

Page 100: ... 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 101: ...he Text widget Attendance 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 th...

Page 102: ...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 103: ...s On the left is the ID of different MFRC522 RFID modules and on the right is the time of punching in Note If the person 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 5 5 Cloud4RPi 99 ...

Page 104: ...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 105: ...to a 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 programming for beginners Da Vinci Kit for Raspberry Pi This is an advanced Raspb...

Page 106: ...amples 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 Program ming If you download a system with only a desktop you can click Preferences Recommended Software Program ming to install the Scratch 3 ...

Page 107: ...rt Or click Animate A Name and then learn online tutorial on the Scratch official website Required Components A Screen Scratch 3 either online or 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 Lesson Guide My Name is Abby In the lower right corner of Scratch there are t...

Page 108: ...SunFounder TS 10 10 1 inch Touch Screen First delete the original sprite we don t need it Then choose a sprite 104 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 109: ...SunFounder TS 10 10 1 inch Touch Screen Find the Letter sprite Repeat several times to spell out your name like me Abby 5 7 Scratch Projects 105 ...

Page 110: ...nge its color Click on the Glow A sprite and let s write a bit of code for it When A is clicked it changes its color Click on the sprite find when this sprite cliked in Events and drag it to the right coding area 106 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 111: ...SunFounder TS 10 10 1 inch Touch Screen Drag change color effect by from Looks to the bottom of when this sprite cliked 5 7 Scratch Projects 107 ...

Page 112: ... the Glow B wizard When the letter B on the stage is clicked it will rotate in a circle Do you know why B is rotated 15 degrees 24 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 108 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 113: ...inch Touch Screen 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 5 7 Scratch Projects 109 ...

Page 114: ... zoom and rotate when clicked 5 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 tell 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 Scratch offi...

Page 115: ...e 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 5 7 Scratch Proje...

Page 116: ...Touch Screen Harley is hungry He asked his friend Perry where is the banana Click on your Harley sprite and then click on the Event category Drag when clicked to the coding area on the right 112 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 117: ...SunFounder TS 10 10 1 inch Touch Screen Click on the Looks category and drag say Hello for 2 second to the bottom of when clicked 5 7 Scratch Projects 113 ...

Page 118: ... 1 inch Touch Screen 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 114 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 119: ...SunFounder TS 10 10 1 inch Touch Screen Click on the Frog sprite add a 3 second delay block wait for Harley to finish speaking and then it speaks 5 7 Scratch Projects 115 ...

Page 120: ... Harley went to the 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 come to the park together after the conversation 116 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 121: ... come to the park alone and there should be bananas on the table So we have to make Perry disappear Click on the Frog sprite add an event when backdrop switches to and find hide and show in Looks Let the Perry appear at the right time 5 7 Scratch Projects 117 ...

Page 122: ...SunFounder TS 10 10 1 inch Touch Screen Add the Banana sprite and adjust the angle 118 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 123: ...SunFounder TS 10 10 1 inch Touch Screen Also let it appear at the right time 5 7 Scratch Projects 119 ...

Page 124: ... 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 click Make Music an...

Page 125: ...s do some actions Lesson Guide We Need the Drums Click on the Add Extension 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 5 7 Scratch Projects 121 ...

Page 126: ...SunFounder TS 10 10 1 inch Touch Screen Play Drum highhat Click on the Drum highhat sprite and drag out the play drum block in the Music expansion module 122 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 127: ... to 5 Open Hi Hat then use the next costume block to switch the appearance of Drum highhat Now you can play the Drum highhat Play Drum snare Click on the Drum snare sprite and drag out the play drum block in the Music expansion module 5 7 Scratch Projects 123 ...

Page 128: ... be smart enough to program and implement this game soon Next we will add some challenges to enrich our game content Add Drum sprite Drum Kit sprite and Drum cymbal sprite modify their size and choose suitable sound effects In this way we have made a drum set Sprite Size Instrument tone options Drum 200 3 Side Stick Drum Kit 150 2 Bass Drum Drum cymbal 200 4 Crash Cymbal 124 Chapter 5 PROJECTS AND...

Page 129: ...cker Game and then learn online tutorial on the Scratch official website Required Components A Screen Scratch 3 either online or offline You Will Learn Pick random number Change the position size and color of the sprite Make a variable Lesson Guide Let the balloons appear randomly First add Balloon1 sprite and Colorful City backdrop 5 7 Scratch Projects 125 ...

Page 130: ...SunFounder TS 10 10 1 inch Touch Screen Set the balloon to a random position 126 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 131: ...SunFounder TS 10 10 1 inch Touch Screen Let it change the color and size randomly 5 7 Scratch Projects 127 ...

Page 132: ...the stage area Click 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 Make a Variable and named score 128 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 133: ... Touch Screen 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 5 7 Scratch Projects 129 ...

Page 134: ...hooting 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 Or click Shooting Game and then learn online tutorial on the Scratch offici...

Page 135: ...load the Crosshair sprite and the target background you can find them under the path 10 1 touch screen scratch materials You have downloaded from github 10 1 touch screen before Click the icon below the sprite list select Upload Sprite Option find the Cross Hair svg file and upload it Similarly upload the backdrop Target jpg 5 7 Scratch Projects 131 ...

Page 136: ...SunFounder TS 10 10 1 inch Touch Screen Let s take aim When aiming the Crosshair will slightly shake we are now going to use the glide block to achieve this effect 132 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 137: ...SunFounder TS 10 10 1 inch Touch Screen Set the random position and size of the Crosshair sprite 5 7 Scratch Projects 133 ...

Page 138: ... more stable Or is it more swaying Let 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 134 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 139: ...oring mechanism Shooting 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 s use the Touching Color block to judge This block has a color picker and we use it to pick up the red color on the target 5 7 Scratch Projects 135 ...

Page 140: ...SunFounder TS 10 10 1 inch Touch Screen Use the same method to set corresponding scores for different color circles 136 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 141: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 137 ...

Page 142: ...ay we use the scratch stage to simulate an underwater world and then add the Star sprite and fish sprite to make a hit the magic fish 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 Screen Scratch 3 either online or offline You Will Learn Let the sp...

Page 143: ...ppear at the coordinates 240 120 and then let it swim left and right Use the if on edge bounce 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 5 7 Scratch Projects 139 ...

Page 144: ...his Star is rising Let the Star appear at 0 120 If we press the or key on the keyboard it will go left and right We use the key pressedblock to determine the keyboard and use change x by to move the sprite 140 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 145: ...SunFounder TS 10 10 1 inch Touch Screen 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 5 7 Scratch Projects 141 ...

Page 146: ...SunFounder TS 10 10 1 inch Touch Screen Something is wrong The Star sprite should continue to rise until it reaches the height of the Fish sprite remember 142 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 147: ...ouch block to determine 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 Hit broadcast This broadcast will tell the entire program that something called Hit has happened All sprite and even the backdrop can hear this broadcast and respond accordingly 5 7 Scratch Projec...

Page 148: ...0 10 1 inch Touch Screen Back to the programming interface of the Fish sprite use a when I receive block to receive the Hit broadcast and then use Next costumeto change your form 144 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 149: ...e will increase by 1 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 Hit broadcast let the timer increase by one to increase the game time 5 7 Scratc...

Page 150: ...scription 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 p...

Page 151: ...Arrange a 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 github 10 1 touch screen 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 ...

Page 152: ...2 num3 and num4 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 148 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 153: ...SunFounder TS 10 10 1 inch Touch Screen When we click the sign in front of the variable the variable will disappear from the stage 5 7 Scratch Projects 149 ...

Page 154: ... costume to the next costume and switch the value of the variable num1 if num1 0 change num1 to 1 In this way the num1 variable can record the value on the blackboard in real time every time the Zero sprite switches costume Copy the program for the remaining three Zero sprites and modify the variable names 150 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 155: ...ary numeral system which uses only two symbols typically 0 zero and 1 one How to convert binary to decimal For binary number with n digits dn 1 d3 d2 d1 d0 The decimal number is equal to the sum of binary digits dn times their power of 2 2 n decimal d0 2 0 d1 2 1 d2 2 2 If binary is 1000 the corresponding decimal should be 1x2 3 0x2 2 0x2 1 0x2 0 8 So what is the decimal number of 1010 1 2 3 0 2 2...

Page 156: ...n 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 right result or a wrong result we have to regenerate the random number and proceed to the next round of the game 152 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 157: ...lt variable when the Enter 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 right message otherwise we broadcast a wrong message 5 7 Scratch Projects 153 ...

Page 158: ...ck on the Zero sprite a Pop sound effect will be emitted 1 point will be deducted for incorrect answers 5 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 Components A Screen Scratch 3 either online or offline You Will Learn Add more c...

Page 159: ...ites 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 Trees png file and upload it Click Costumes and then click the Upload Costume option to upload Trees2 png Trees3 png Trees4 png and Trees5 png 5 7 Scratch Projects 155 ...

Page 160: ...SunFounder TS 10 10 1 inch Touch Screen Copy out the second Trees 156 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 161: ...es2 sprites kept moving to the left so it looked like the Parrot sprites were flying 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 5 7 Scratch Projects 157 ...

Page 162: ...der TS 10 10 1 inch Touch Screen 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 158 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 163: ...unFounder TS 10 10 1 inch Touch Screen Now click on the green flag to see the effect of this flight Very good the Parrot sprite seems to be flying to the right side of the stage 5 7 Scratch Projects 159 ...

Page 164: ...e 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 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 160 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 165: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 161 ...

Page 166: ...SunFounder TS 10 10 1 inch Touch Screen Change the costume so that Parrot has flight animation When we press the Space button Parrot s clothing switches to Parrot b 162 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 167: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 163 ...

Page 168: ...e 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 Game failure mechanism When the Parrot sprite encounters a tree or falls to the ground during the flight we judge the game is over and then we stop all scripts 164 Chapter 5 PROJECTS AND ACTIVITI...

Page 169: ...the game start screen let us prepare for the game 5 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 s take action Click on the green flag to start Or click Paint Box and then learn online tutorial on the Scratch official website Required Components Firs...

Page 170: ...dify 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 github 10 1 touch screen before and finally set the size of the Pencil sprite and Block X...

Page 171: ...SunFounder TS 10 10 1 inch Touch Screen Then we add the Pen extension function 5 7 Scratch Projects 167 ...

Page 172: ... Pencil sprite First we need to make the Pencil sprite move with the mouse If the mouse button is pressed we call the pen down block in the Pen extension function which can draw along the track of the cursor Otherwise call thepen up block to stop drawing 168 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 173: ...0 10 1 inch Touch Screen 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 5 7 Scratch Projects 169 ...

Page 174: ...entire Pencil 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 red message 170 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 175: ...return the code of the Pencil sprite and when it receives the red 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 blue message 5 7 Scratch Projects 171 ...

Page 176: ...ction 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 Costumes 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 approp...

Page 177: ... the Pencil sprite When it receives the eraser message it will change to the Eraser costume so that when we click on the Eraser sprite we can change the Pencil sprite 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 5 7 Scratch Projects 173 ...

Page 178: ...cil sprite is 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 red message and the blue message We want to switch back to the original Pencil a costume 174 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 179: ...e fun we need to be able to change the width of the Pencil at any time Create a new variable named width then right click the width variable on the stage select slider and then you will see a slider on the stage that can change the value of the width variable 5 7 Scratch Projects 175 ...

Page 180: ...SunFounder TS 10 10 1 inch Touch Screen Use the value of the variable width as the size of the Pencil 176 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 181: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 177 ...

Page 182: ... of the 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 pen up function to stop painting 178 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 183: ...n Challenge I believe that you will be smart enough to program and implement this game soon Next we will add some challenges to enrich our game content Add more color brushes to make a Paint Box that belongs to you 5 7 Scratch Projects 179 ...

Page 184: ...camera to control the Monkey sprite Or click Eating Banana Game and then learn online tutorial on the Scratch official website Required Components A Screen Scratch 3 either online or offline You Will Learn Install camera on this screen Add Video Sensing expansion module and use camera function Let the camera detect our movements Lesson Guide Install and use the camera For the camera installation t...

Page 185: ...prite and 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 5 7 Scratch Projects 181 ...

Page 186: ...et the Monkey 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 182 Chapter 5 PROJECTS AND ACTIVITIES ...

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

Page 188: ... 1 inch Touch Screen Required Components A Screen 8G SD Card Scratch 3 either online or offline Micro SD Card Reader 40 Pin Ribbon Cable T Type GPIO Extension Board Breadboard Button 184 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 189: ...fic steps Insert the T type GPIO extension board into the breadboard and build the circuit as shown below Programming with Scratch 3 On the left of Scratch 3 main page are some neatly arranged blocks with which you can drag to program In this project we need to add in other two functions Music and Raspberry Pi GPIO The Music function to play instruments and drums and the Raspberry Pi GPIO function...

Page 190: ...0 1 inch Touch Screen 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 186 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 191: ...SunFounder TS 10 10 1 inch Touch Screen Press these three buttons on the breadboard and there emits the tones Do Re Mi 5 7 Scratch Projects 187 ...

Page 192: ... can turn this screen into a game screen playing with your friends a smart alarm showing the weather and time a display monitoring your robot s action and many other things This article will show you how to DIY a Monitor Device Let s take a look 188 Chapter 5 PROJECTS AND ACTIVITIES ...

Page 193: ...3 either online or offline Micro SD Card Reader 40P Ribbon Cable T Type GPIO Extension Board Breadboard PIR Module Camera Module FFC Cable Jump Wire F M You Will Learn Use Raspberry Pi extensions on Scratch Use audio functions on Scratch Use PIR module Lesson Guide 5 7 Scratch Projects 189 ...

Page 194: ...d build the circuit For the camera installation tutorial please refer to Assemble the Camera Module Programming with Scratch 3 In this step you will learn how to upload the prepared music to the Scratch Tap the Sounds option on the left upper cornerthen tap the speaker icon and choose Upload Sound icon to upload the prepared music file hello finally tap Open to confirm 190 Chapter 5 PROJECTS AND A...

Page 195: ...con at lower left corner and choose Video Sensing and Raspberry Pi GPIO to add two functions Back to the main page drag a when gpio 0 is high from Raspberry Pi GPIO function and a play sound hello until done to the coding area 5 7 Scratch Projects 191 ...

Page 196: ...em that we used before Raspberry Pi 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 Raspberry Pi If you have other systems installed but some of them may have some bugs that make some of the functions unusable we can only sug...

Page 197: ...On the camera module or Raspberry Pi you will find a flat plastic connector Carefully pull out the black fixing switch until the fixing switch is partially pulled out Insert the FFC cable into the plastic connector in the direction shown and push the fixing switch back into place If the FFC wire is installed correctly it will be straight and will not pull out when you gently pull on it If not rein...

Page 198: ... 10 1 inch Touch Screen Warning Do not install the camera with the power on it may damage your camera Open Raspberry Pi Configuration In the Interfaces option Enable the Camera and then click OK 194 Chapter 6 APPENDIX ...

Page 199: ...he 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 6 2 GPIO Extension Board Before starting the project you first need to know more about the pins of the Raspberry Pi which is key to the build circuit 6 2 GPIO Extension Board 195 ...

Page 200: ...ns 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 196 Chapter 6 APPENDIX ...

Page 201: ...ro 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 s HDMI port Make sure the screen is plugged into a wall socket and turned on Note For the Raspberry Pi 4 models connect the screen to the HDMI0 port nearest to the power in socket 4 Use the power adapter to power the Ra...

Page 202: ...armpi 2 Network Segment Scanning Network scanning applications can be used to look up the IP address of Raspberry Pi such as Advanced IP Scanner Scan the IP range set and the names of all connected devices will be displayed The default hostname of the Raspberry Pi OS is raspberrypi 6 4 Use the SSH Remote Control Bash is the standard default shell of Linux and can be opened on the Raspberry Pi by u...

Page 203: ...nd 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 Note The characters do not display when typing in the password Make sure to input the correct password 6 4 Use the SSH Remote Control 199 ...

Page 204: ...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 200 Chapter 6 APPENDIX ...

Page 205: ...ss there will 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 6 4 Use the SSH Remote Control 201 ...

Page 206: ...SunFounder TS 10 10 1 inch Touch Screen Here we get the Raspberry Pi connected and it is time to conduct the next steps 202 Chapter 6 APPENDIX ...

Page 207: ... screen more conveniently you can use a 3D printer to print a support The 3D printer file Stand Installation process are shown as follow Step 1 Get ready for 3D printing Step 2 Remove the touch screen main board and let the standoff thread the holes of holders 203 ...

Page 208: ...SunFounder TS 10 10 1 inch Touch Screen Step 3 Assemble the extension board again now you can get a stand up touch screen 204 Chapter 7 3D PRINTED SUPPORT ...

Page 209: ...SunFounder TS 10 10 1 inch Touch Screen 205 ...

Page 210: ...SunFounder TS 10 10 1 inch Touch Screen 206 Chapter 7 3D PRINTED SUPPORT ...

Page 211: ...displayed 3 The picture is distorted in color or displayed with color abnormity like a certain color missing A Please check whether the signal wire is plugged in a good way If the wire is defective or the wiring is loose the signal transmission may be influenced thus causing the fault 4 There appears stripe interference on the display and the picture is dark A Please check whether the socket and t...

Page 212: ...SunFounder TS 10 10 1 inch Touch Screen 208 Chapter 8 FAQ ...

Page 213: ... 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 209 ...

Reviews: