Charlotte Latin 2020 Week 8 Group Assignment

Embedded Programming

This week our group assignment was to compare the performance and development workflows for different microcontroller families.

Comparison to Raspberry Pi

We decided to compare AVR (arduinos and attinies) to Raspberry Pi. According to this website, Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse. A Raspberry Pihas an ARMv6 700 MHz single-core processor, a VideoCore IV GPU and 512MB of RAM. it uses an SD card for its operating system and data storage. The Raspberry Pi officially supports Raspbian, a lightweight linux OS based on Debian.

We started by following this tutorial to set it up and start using the interface.

These are the components of the Raspberry Pi.

We learned that the Raspberry Pi is capable of higher storage capacities and dynamic memory than the AVR chips because the Raspberry Pi contains distinct RAM and memory modules as opposed to the AVR chips' all-in-one design.

We fully set up the Raspberry Pi by making all the connections it needs to run, as detailed in the tutorial and shown in the below image.

Here was an image of the setup:

And the raspberry pi booting up:

We were able to skip the general configuration steps that you are prompted to do when using the Raspberry Pi for the first time, it seemed that this step had already been completed by the last user of the pi.

Programming the Raspberry Pi

The raspberry pi does not only work as a computer, it also had GPIO pins that can be interfaced with other devices. We used a breadboard and attached an LED and resistor to pin 18 and to gnd.

To start with programming the RPi, we followed a tutorial on this site.

We opened up the start menu, navigaged to "Programming", cliked on IDLE, and created a new Python file.

Then, we populated the python file with the following code:

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW)
        

To make the LED blink 10 times with a delay of 1 second we modified the code to the following:

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)

for _ in range(10):
    print "LED on"
    GPIO.output(18,GPIO.HIGH)
    time.sleep(1)
    print "LED off"
    GPIO.output(18,GPIO.LOW)
    time.sleep(1)