Skip to content

Small programs for basic sensor/motor control with Raspberry Pi and Arduino.

License

Notifications You must be signed in to change notification settings

the-other-mariana/circuits-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Circuits Workshop

Experiments in c with raspberry and arduino.

A) Raspberry Pi 3 (Model B)

Documentation: WiringPi Core Functions

Wiring Pi Pinout:

alt text

Resources

  1. Raspbian OS .img file.
  2. SD Card Formatter 0500 .exe file.
  3. VNC Viewer 6.18.907 for Windows 64bit .exe file.
  4. win32diskimager 1.0.0 install .exe file.

Turn On Your Raspberry with PC

  1. You need to go to Control Panel > Networks & Internet > Network Connections.

alt text

  1. Click on Ethernet option.

alt text

  1. Double click on TCP/IPv4 option.
  2. Instead of Automatic IP, choose Fixed IP Address.
  3. Configure it as follows:

alt text

  1. Accept changes.
  2. Put a microSD card (OS) inside the Raspberry.
  3. Connect a universal-USB cable from the Raspberry to your computer.
  4. Connect an Ethernet cable from the Raspberry to your computer.
  5. Open VNC Viewer For Windows (v6.18.907).
  6. Choose the IP address of your Raspberry, in this case 192.168.0.144.

alt text

  1. In VNC you will see the Raspberry's screen projected.

Note: Operating System inside the microSD Memory (32GB) is Linux Raspbian.

Compile & Run Codes From Raspberry

Through the terminal, go to the folder's directory where the source code is and type:

To Compile

& gcc codename.c -o outputname -lwiringPi

To Run

& sudo ./outputname

Turn Off Your Raspberry

  1. Click the Raspberry Icon.
  2. Click on Shutdown.
  3. Close VNC Viewer.
  4. Wait a few seconds and unplug the Ethernet and the Universal cables.
  5. In your computer, go back to Control Panel > Networks & Internet > Network Connections.
  6. Choose Automatic IP Address again.

B) Arduino Nano

Pinout:

image

Set Up

  1. Download the Arduino IDE .exe file from here.

  2. Connect your Arduino to your computer.

  3. If your Arduino says in the back CH340G, you need to download another driver for the USB port to be recognized from this link. More details on this process were taken from here.

  4. On the IDE, go to Tools > Board > Arduino Nano.

  5. On the IDE, go to Tools > Processor > ATMega328P.

  6. On the IDE, go to Tools > Port > COM4. This port can change, to see which one it takes, go to Device Manager > COM and LPT Ports > USB-SERIAL CH40 (COM4).

To Run

  1. Open the .ino code that does something.

  2. Click on Verify (check arrow on top-left corner).

  3. Click on Upload (arrow beside the Verify button).

  4. Open the serial port (console) to see the printed output. This button is on the top right corner.

To Stop

  1. Open the .ino code that does nothing.

  2. Click on Upload.

  3. Unplug the arduino.

You can simply just unplug the arduino.

Content

Session 01 Led Blink

Small code that makes a led blink with a constant delay.

alt text

Session 02 Touch Sensor & Led

Small code that makes a led turn on while pressing a touch sensor.

alt text

Session 03 Passive Buzzer Plays Music Notes

Small code that sends a frequency number as voltage to a buzzer to make it play different notes.

alt text

Session 04 Temperature Printed in Console

Small code that prints in the console the Relative Humidity (%) and Temperature (°C and °F).

alt text

Session 05 Led Switch with Touch Sensor

Code that makes a led light switch on and off using a touch sensor as input.

alt text

Session 06 Arduino Nano & Ultrasonic Sensor

Code that prints the distance of obstacles using Arduino Nano and Ultrasonic Sensor.

alt text

Session 07 Arduino Nano & Ultrasonic Sensor With Touch Button

Code that prints the distance of obstacles using Arduino Nano and Ultrasonic Sensor, but only whenever a touch button is turned on.

alt text

Session 08 Arduino Nano & Ultrasonic Sensor Array

Code that prints the distance of obstacles stored in an array coming from 3 different ultrasonic sensors using Arduino Nano board.

alt text

Session 09 Vibration Motor Triggering With Ultrasonic Sensor Array

Code that stores the distance of detected objects of an array of ultrasonic sensors, and whenever an object is too close, its corresponding vibration motor vibrates for two seconds.

alt text

About

Small programs for basic sensor/motor control with Raspberry Pi and Arduino.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published