[ Log In ]
Newbie Hack Shirt Back
The STM32 ultra basic kit showing all of the components

STM32 Ultra Basic Kit Special Introductory Price!

$34.95
Qty:
The ARM STM32F030 Advanced kit with the book ARM Microcontrollers Programming and Circuit Building Volume 1

ARM Advanced Kit with Book Vol 1

$158.00
Qty:
ST Link v2 for STM32 and STM8 microcontrollers top view of all components

ST-Link v2 STM32 and STM8 Programmer

$9.95
Qty:
STM32F0 microcontroller and interface board top view

STM32 M0 MCU and Interface to Breadboard

$14.95
Qty:
Top view of the bluetooth module

Bluetooth Module

$17.50
Qty:
The ARM microcontroller beginners kit

ARM Microcontroller Beginners Kit (STM32F0)

$39.95
Qty:

ARM Microcontroller Intermediate Kit (STM32F0)

$89.95
Qty:

ARM Microcontroller Advanced Kit (STM32F0)

$119.95
Qty:
USB 2.0 Cable 10 Foot Type A Male to Type B Male

USB 2.0 Cable Type A Male to Type B Male - 10 FT

$4.80
Qty:

10. Arduino for Production!! How to Receive Input from a Pin for Push Button Input (GPIO) on the ARM Microcontroller

In this video we’ll take a look the GPIO input side of things and using a push button connected to the GPIO pins and output to an LED. We’ll take a push button switch and have the microcontroller read the push button switch on one of the GPIO pins and we’ll output on another pin with a different port on an LED. When we press the button the LED will turn on.

For the LED output we’ll use the same port and pin that we used in the instructional video for the LED output which is Port C Pin 6 located on Pin 37. We’ll use a resistor and an LED and it will be connected back to ground. When we output a 1 or high to this pin, we will light up the LED because it is connected to ground.

For the input, we will connect the push button switch to Pin 37 which is Port B Pin 1. The push button schematic will come from 27 and it will have a resistor. It will be a 330ohm resistor and its purpose is to protect the pin. From the pin, another resistor will be connected to ground. The ground resistor will be at a high resistance so it will not be using a lot of current when the switch is depressed. This will be a 22k ohm resistor.

The resistor coming from the pin will be a 330ohm resistor and this will only be used when connected to VCC. In the pressed state, you will have a connection between ground and VCC which will be at 220k ohms. It will also be connecting to the pin at 330ohm resistance so we’re protecting the pin but still getting the high signal from VCC.

When the push button is not being depressed, the pin is going to be directly connected to ground. Pull the pin down as a natural state rather than pulling it internally with software with the PUPD register, because this only pulls it down to about 40k ohms. We’ll be pulling it down at 220k ohms which will provide more resistance and less current draw when the push button is pressed.

If we didn’t have a pull down resistor externally, and a pull up pull down resolved internally, we’d have a floating state when the push button is not pressed, which would cause unpredictable behavior. Even waving your hand over the circuit could cause unpredictable outcomes.

When you’re putting a circuit together that has an input (a mode for that particular pin that is set as input) you want to make sure that it is either pulled down or pulled up and not in a floating state. In a floating state that input will act like an antenna that can pick up noise. If that noise goes above or below TTL circuits, it will produce an outcome.

Now that we understand how the circuit works, we can proceed to put together the circuit on a breadboard. The first thing you’ll want to do is set up your board so you’ll have all your power and power rails connected together. Also make sure you have the Boot 0 connected to ground with a 510ohm resistor. You can see the step by step instructions on this preparation on the ARM Microcontroller Tutorial 5 here.

We’ll start with connecting the LED to Port C, Pin 6 which is on Pin 37. Insert the 330ohm resistor across the two tie-strips, and then the LED with the flat side toward the ground.

Now connect the switch to Pin 27 which is Port B Pin 1. Start with the 330 ohm resistor and the two tie-strips.

Next put the switch in allowing the lead of the switch in the back to share one of the slots with the tie-strip with the resistor to leave enough room to put the other resistor.

Next put the 220K ohm resistor on the same tie-strip to ground.

Now we only have to put in the connection from VCC to the other side of the switch.

Now when the switch is depressed, the leads will be connected, and VCC will be connected to ground via the 220k ohm resistor. It will also be connected back to Pin 27 with the 330 ohm resistor. The circuit should now be ready to go.

In the next tutorial we will talk about looking at the registers we need to use for control and reading the input. We’ll also get into programming, starting with pseudo-code.


01. Arduino for Production!! Introduction to ARM Microcontrollers
02. Arduino for Production!! How to Instal and Set up the Arduino IDE (Integrated Development Environment) for the ARM Microcontroller
03. Arduino for Production!! How to Connect the ST-Link v2 ARM Programmer to your Computer
04. Arduino for Production!! How to Use the CoIDE (Adruino IDE) for ARM Microcontroller Development
05. Arduino for Production!! How to Connect the ST-Link v2 to the ARM STM32 Microcontroller
06. Arduino for Production!! How to Output to a Pin to Blink an LED on the ARM Microcontroller Part 1
07. Arduino for Production!! How to Output to a Pin to Blink an LED on the ARM Microcontroller Part 2
08. Arduino for Production!! How to Output to a Pin to Blink an LED on an ARM Microcontroller Part 3
09. Arduino for Production!! Can Not Connect to Target! How to Establish a Connection Again.
10. Arduino for Production!! How to Receive Input from a Pin for Push Button Input (GPIO) on the ARM Microcontroller
11. Arduino for Production!! How to Receive Push Button Input on the ARM Microcontroller Part 2
12. Arduino for Production!! How to Receive Stable GPIO Push Button Input on the ARM Microcontroller - Software Debouncing Part 1
13. Arduino for Production!! How to Receive Stable GPIO PUSH Button Input onthe ARM Microcontroller - Software Debouncing Part 2
14. Arduino for Production - How to Establish Software Debouncing on the ARM Microcontroller Exclusive
15. Arduino for Production!! How to Interface an LCD on the ARM Microcontroller Part 1
16. Arduino for Production!! How to Interface an LCD on the ARM Microcontroller Part 2
17. Arduino for Production!! How to Interface an LCD to an ARM Microcontroller Part 3
18. Arduino for Production!! How to Interface an LCD to the ARM Microcontroller Part 4