SINGLE MOTOR SETUP PI (HAT)

Disclaimer

Any actions and or activities related to the material contained within this Website is solely your responsibility. The misuse of the information in this website can result in criminal charges brought against the persons in question. Cyber Security Associates Limited will not be held responsible for any criminal charges brought against any individuals misusing the information in these projects to break the law.  

Please ensure you are using the latest SD Card image which is available here.

 

Teacher Overview

 All of us are used to buying prepacked products that are sealed and cannot be broken into without invalidating a warranty or breaking the terms of use. It is important that the students understand that the products we spend significant amounts of money on are made out of very simple and versatile components.  Your home PC is a selection of components that work together and are connected and locked like lego bricks. The Raspberry Pi is a micro-PC made up of a 1.2GHz quadcore processor, a graphics chip and an array of connectors to additional components that it can interact with. The computing power of the Raspberry Pi allows for more complicated projects to be created, or even combined to create bigger and better creations.

The Explorer HAT Pro (HAT) is a shield that can be plugged directly onto the Raspberry Pi 42 GPIO Pins. The wiring allows for easier identification of peripherals and their polarity than trying to understand which how to control each Pin and what they do for beginners. The layout of this HAT allows for easy identification of the Motor pins and the associated Python library for the HAT which is imported using the Import command at the beginning of the code. There are additional peripherals that can be attached to the HAT, allow the students the time to research what additional sensors could be attached to this project to develop it.

Python is a well-known programming language released in the early 1990s. It’s a simple and versatile language that provides the foundations for cyber security and computer coding. In this project we will introduce defining a function which is a segment of code that can be reused in different places without having to write out all the components of that function. If statements are conditional expressions that will either be true or false, allowing for different areas of code to be initiated depending on previous situations, if statements can also trigger different segments of code called else and elif. When using python, it is important to explain to your students that using indents is VITALLY important, python relies on indents to correlate related code. For example;

If statement:

Conditional code

More conditional code

Else statement:

More conditional code

Even more conditional code

If indents aren't placed properly then the code will not implement and cause a lot of frustration.

 

Suggested Year Group

The suggested age group is 12+, this is an easy way to introduce simple electronics and programming to the students.

 

Learning Outcomes

  • Show the students how the Raspberry Pi works and how it connects to other peripherals;

  • Teach students how to program in Python;

  • Illustrate how many machines use a combination of a processor and peripheral hardware to work.

 

Hardware Required

Component Number (Peli Case)

(Base) 4 + 5

(Base) 5

(Base) 8

(Level 1) 2

(Base) 25

(Level 1) 3

(Level 1) 3

(Level 1) 3

(Level 1) 5

(Level 1) 1

Component

Raspberry Pi + Case

Raspbian SD Card

Explorer HAT Pro

Motor

Wheel

Male Female Wires

HDMI

Wireless Keyboard

Wireless Mouse

Power Supply

 

VIDEO GUIDE

 

Conclusion

The purpose of this project is to introduce students to the Raspberry Pi and how it can be used to control additional hardware and interact with the real world. The HAT is a good way to introduce how the Raspberry Pi connects with different sensors, but you should also be aware of its limitations for a more complex project. This project is also designed to start the students thinking about how they can create solutions to what might seem like complex problems by breaking them down and seeing the individual components. Challenge the students to create their own projects that could be solved with a Raspberry Pi based project, using hardware and software and collect these designs for future evaluation.