SINGLE MOTOR SETUP PI

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

Physical computing is the process of creating interactive physical projects by linking hardware and software. These projects can fulfil a range of requirements depending on the situation you are in and what you are trying to do. This is where imagination and technology meet, and the potential applications of these devices/projects are infinite. We are surrounded by many computers that control a lot of sensors and motors. One easy example is a motion sensing door, usually there is a sensor that detects movement in front of the door. Once movement has been detected a motor is started to move the door out of the way and then return it after a specified amount of time. All of this is controlled by a computer. Not all computers take the form of a smart phone, laptop, games console or PC, some computers can be made extremely small and be very simple, only able to hold the code for a single operation instead of installing an Operating System (OS) on it.  

The Raspberry Pi is a computer, it is simple compared to a desktop PC or a laptop but in its own respect and size it is very powerful. The Raspberry Pi can be physically configured to connect to thousands of sensors, motors, etc and can be used for many different projects. The OS on the Raspberry Pi is called Raspbian which is a version of a Linux that is made specifically for the Raspberry Pi. There are many OS that you have been exposed to already, you have probably used Windows, Android or maybe iOS. Each OS has some differences but the main reason for any OS is to interface the hardware you have with the software that is required to control it. When using any computer there are 2 primary ways of interacting with the software.

Usually we use the Graphical User Interface (GUI) and this can be designed very nicely and be pleasing to the eye. The other way to use your computer is with the Command Line Interface (CLI) which is a much more powerful way to interact with your computer. The CLI usually offers more options than the GUI and you can then combine different applications together and is a better way to learn to understand your computer and how it works. You do need to learn how the CLI works and throughout these projects you will be exposed to a range of projects that will use the CLI and you will become proficient in using the CLI.

 
 

L298N H-Bridge Motor Controller

The L298N Motor Controller is how you can interface DC motors with the Raspberry Pi and to also control them. There are alternatives that can interface directly with the Raspberry Pi, but this driver is used extensively in industry and is worth understanding how it works. The L298N Motor Controller can interface with different power sources, allowing you to have more power than the 4 AA batteries we will use in this project. It also allows you to use Python (code) to control the power and make the motors move forwards and backwards. It is important to think of additional applications for this project as you work through it, where else could you use this?

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

1.      Introduction to Raspbian OS; 

2.      Learn how to physically configure the L298N Motor Controller to control a DC Motor; 

3.      Understand how physical computing is used around us. 

 

HARDWARE REQUIRED

Component Number (Peli Case)

(Base) 4 + 5

(Base) 5

(Level 1) 2

(Base) 8

 

(Level 1) 3

(Level 1) 2

(Level 1) 3

(Level 1) 5

(Level 1) 3

(Base) 9

(Level 1) 1

 

Component Number (Box Case)

Slot 1

Slot 11

Slot 11

Slot 6

Slot 11

Slot 11

Slot 11

Slot 11

Slot 12

Slot 11

Slot 2

Slot 13

 

Component 

Raspberry Pi + Case

Raspbian SD Card

DC Motor

L298N Dual H-Bridge Motor Controller

4 AA Batteries

Male Male, Male Female Wires

4 AA Battery Holder

HDMI

Wireless Mouse

Wireless Keyboard

5 Inch LCD Screen 

Power Supply Unit

 

VIDEO GUIDE

 

Conclusion

Understanding how electronics work and the interaction of code to control physical devices is a skill that you can develop throughout and after your education. This project is designed to introduce you to electronics like the L298N motor controller and a simple amount of python code. Make sure you understand what the code is telling you. At the beginning code can look daunting but there are many rules that are the same in different programming languages, creating functions is almost a universal rule for a lot of languages so the skills you start learning now will help you to learn many other programming languages as well. Research why Python is a good language to start off with and why it is important to learn the command line code.