This website uses affiliate links which may earn us a commission for purchases made at no additional cost to you.
These are some of the items likely discussed during an Arduino & Raspberry Pi Introduction.
Arduino Microcontrollers
I first got started with the ELEGOO UNO R3 (purchase). It is nice because it comes with the USB cable and has a good amount of GPIO pins. When I was doing a project where I needed more GPIO pins, I went with the ELEGOO MEGA R3 Board (purchase). Also comes with the USB cable and has way more GPIO pins.
If you are doing IoT though, I recommend the Arduino Nano 33 IoT with Headers (Purchase). The one with the Headers attached means you can be using your breadboard without having to do any soldering. These have Wi-Fi, which is very important for IoT.
Raspberry Pi Single Board Computers
I recommend CanaKit, especially their Raspberry Pi 5 Starter Kit PRO (Purchase). I’ve done 5 virtual marketing events and we’ve used a few hundred CanaKit Starter Kits between the 4s and the 5s. Not only have I always been impressed with them, the participants were also all very happy.
Components
I’ve been using the ELEGOO 3pc Breadboard (Purchase) but if you are using the Raspberry Pi, I recommend the UCTRONICS GPIO Breakout Kit (Purchase)
Better to go with 120pcs Breadboard Jumper Wires (Purchase)
GeeekPi ABS Holder (Purchase) (preferred) or SunFounder RAB Holder (Purchase) (second choice) – but both of these DO NOT work well with Raspberry PI GPIO Breakout Kit(s). I think it is the GeeekPi one that is better than the other because it only has one size of screws, but I need to confirm. Also the rubber feet on the SunFounder ones are junk and don’t stay attached.
HiLetGo 37 Sensor Assortment Kit (Purchase)
KAVOO 5PCS DC 5V Mini Traffic Light LED Display (Purchase)
HC-SR04 Ultrasonic Module Distance Sensor (Purchase)
// Sketch for HC-SR01 Sonic Distance Sensor
// Component: TBD
// Tutorial: TBD
// 10 is really close, 80 is someone walking up
// PWM for brightness?
// Change to the pin numbers to the pin on the Traffic Light for the color
#define GREEN_PIN 11
#define YELLOW_PIN 12
#define RED_PIN 13
#define TRIGGER_PIN 9
#define ECHO_PIN 10
#define RED_PIN 13
float duration;
float distance;
float green_threshold = 20;
float yellow_threshold = 15;
float red_threshold = 5;
// The setup() section runs once when the Arduino starts up
void setup() {
pinMode(RED_PIN, OUTPUT);
pinMode(YELLOW_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(TRIGGER_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(TRIGGER_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGGER_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance = (duration*.0343)/2;
Serial.print("Distance Detected: ");
Serial.println(distance);
if (distance < red_threshold) {
digitalWrite(GREEN_PIN, HIGH);
digitalWrite(YELLOW_PIN, HIGH);
digitalWrite(RED_PIN, HIGH);
} else if (distance < yellow_threshold ) {
digitalWrite(GREEN_PIN, LOW);
digitalWrite(YELLOW_PIN, HIGH);
digitalWrite(RED_PIN, HIGH);
} else if (distance < green_threshold) {
digitalWrite(GREEN_PIN, LOW);
digitalWrite(YELLOW_PIN, LOW);
digitalWrite(RED_PIN, HIGH);
} else {
digitalWrite(GREEN_PIN, LOW);
digitalWrite(YELLOW_PIN, LOW);
digitalWrite(RED_PIN, LOW);
}
delay(200);
}