Raspberry pi puzzle for affordable coding and other skills teaching. This is an affordable platform dedicated to teachers and parents to create educational games for their students and kids from the age of 4-7 yo. It is a screen-free open source project that doesn't need a constantly available source of electricity and aims to give kids in unprivileged areas the opportunity to learn basic skills of this era like coding.
In a world running on computers, coding is becoming essential knowledge and many countries has already included it in their curriculum. Many educators and researchers argue that the basic skills of coding, such as sequencing, pattern recognition and if/then conditional logic, should be introduced alongside or even before traditional reading, writing and math. Recently, many tools have been developed to bring these skills to kindergarteners in a fun and playful way. Most of these tools require computers/tablets, available source of electricity not to mention skyrocketing prices of some products which make it inaccessible to kids in communities lacking financial resources. This project aim to fill the gap between the poor and the rich, giving the less privileged kids (4-7 yo) an affordable, portable, customizable and screen free open source tool to learn not only coding skills but also learn about any educational topic depending on the kit customized and used by the teacher.
For more pictures:
Write the Debian image with the needed packages to the SD card:
To prepare Raspberry Pi SD card using Microsoft Windows and a program called Win32DiskImager ( super easy installation).
Pose estimation is of great importance in many computer vision applications: robot navigation, augmented reality, and many more. This process is based on finding correspondences between points in the real environment and their 2d image projection. This is usually a difficult step, and thus it is common the use of synthetic or fiducial markers to make it easier.
One of the most popular approach is the use of binary square fiducial markers. The main benefit of these markers is that a single marker provides enough correspondences (its four corners) to obtain the camera pose. Also, the inner binary codification makes them specially robust, allowing the possibility of applying error detection and correction techniques.
The aruco module is based on the ArUco library, a popular library for detection of square fiducial markers developed by Rafael Muñoz and Sergio Garrido:
S. Garrido-Jurado, R. Muñoz-Salinas, F. J. Madrid-Cuevas, and M. J. Marín-Jiménez. 2014. "Automatic generation and detection of highly reliable fiducial markers under occlusion". Pattern Recogn. 47, 6 (June 2014), 2280-2292. DOI=10.1016/j.patcog.2014.01.005
An ArUco marker is a synthetic square marker composed by a wide black border and a inner binary matrix which determines its identifier (id). The black border facilitates its fast detection in the image and the binary codification allows its identification and the application of error detection and correction techniques. The marker size determines the size of the internal matrix. For instance a marker size of 4x4 is composed by 16 bits.
The puzzle pieces have 2 faces:
For more pictures:
# import the necessary packages from picamera.array import PiRGBArray from picamera import PiCamera from gpiozero import Button import cv2 import cv2.aruco as aruco import numpy as np import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(16,GPIO.OUT) GPIO.setup(21,GPIO.OUT) GPIO.output(16,GPIO.LOW) GPIO.output(21,GPIO.LOW) # initialize the camera and grab a reference to the raw camera capture camera = PiCamera() rawCapture = PiRGBArray(camera) # camera.resolution = (1024, 768) white = Button(17) white.wait_for_press() # grab an image from the camera camera.capture(rawCapture, format="bgr") image = rawCapture.array gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_100) parameters = aruco.DetectorParameters_create() #lists of ids and the corners beloning to each id font = cv2.FONT_HERSHEY_SIMPLEX #font for displaying text (below) corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters) print(ids) if np.all(ids != None): aruco.drawDetectedMarkers(image, corners) strg = '' for i in range(0, ids.size): strg += str(ids[i])+', ' cv2.putText(image, "Id: " + strg, (0,64), font, 1, (0,255,0),2,cv2.LINE_AA) else: ##### DRAW "NO IDS" ##### cv2.putText(image, "No Ids", (0,64), font, 1, (0,255,0),2,cv2.LINE_AA) puzzle = all(ids[i] <= ids[i+1] for i in range(len(ids)-1)) if puzzle: GPIO.output(21,GPIO.HIGH) else: GPIO.output(16,GPIO.HIGH) # display the image on screen and wait for a keypress cv2.imshow("Image", image) cv2.imwrite('test_detection.png',image) cv2.waitKey(0)
Sometimes it is not convenient to work directly on the Raspberry Pi. Maybe you would like to work on it from another device by remote control.
VNC is a graphical desktop sharing system that allows you to remotely control the desktop interface of one computer (running VNC Server) from another computer or mobile device (running VNC Viewer). VNC Viewer transmits the keyboard and either mouse or touch events to VNC Server, and receives updates to the screen in return.
You will see the desktop of the Raspberry Pi inside a window on your computer or mobile device. You'll be able to control it as though you were working on the Raspberry Pi itself.
(For more details:https://www.raspberrypi.org/documentation/remote-access/vnc/)
List of materials:
Raspberry pi 3 model B+
Power supply 5V 2A
SD card (16 GB)
Pi Camera V2.1
Two LEDs (Green, Red)
Two Resistors (100 Ω)
Ethernet cable for remote access to the raspberry pi
Printed ArUco markers (check document attached "codes_print.pdf")
On your computer download and install the VNC viewer:
For this step you need:
The username and password of the raspberry pi by default:
To get the IP address of the Raspberry Pi, open the terminal and type next to the $ symbol: hostname -i.
To enable the VNC: Menu → preferences → raspberry pi configuration → interfaces → VCN enable.
Insert the IP address of the raspberry pi in the VNC viewer.
Type the password in the authentication box that appears, and that is by default: raspberry
You can find the code ("puzzle") in this path: /home/pi/fatima/tests/exec
To run the code:
This is an example to test the prototype.
Check this link to see how it functions: