Skip to content
Snippets Groups Projects
week09.html 20.9 KiB
Newer Older
<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="GitLab Pages">
    <meta name="description" content="Fab Academy documentation site for Charlotte Fab-C">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="../assets/css/main.css" />
    <title>Charlotte Fab-C - Fab Academy</title>
    
  </head>
  <body class="is-preload">
    <!-- Wrapper -->
      <div id="wrapper">

        <!-- Main -->
          <div id="main">
            <div class="inner">

              <!-- Header -->
                <header id="header">
                  <a href="../index.html" class="logo"><strong>Charlotte - FabLab de Charleroi</strong> Fab Academy website</a>
                  <ul class="icons">
                    <li><a href="https://www.facebook.com/littlebelge" class="icon brands fa-facebook-f" target="_blank"><span class="label">Facebook</span></a></li>
                    <li><a href="https://www.instagram.com/little.belge/" class="icon brands fa-instagram" target="_blank"><span class="label">Instagram</span></a></li>
                    <li><a href="https://gitlab.fabcloud.org/charlotte-vandenbulcke" class="icon brands fa-gitlab" target="_blank"><span class="label">Gitlab</span></a></li>
                  </ul>
                </header>

              <!-- Section -->
                <section id="banner">
                  <div class="content">
                    
                    <header class="main">
                      <h2>9. Output Devices</h2>
                    </header>

                    <section>
                      <h3>Hero shot</h3>

                      <span class="object">
                      <video width="600" height="300" controls>
                      <source src="../images/buzzer-GOThrones.mp4" type="video/mp4">
                      </video>
                      <h3>Assignment</h3>
                      <p>To measure output devices, as asked this week, we used a USB power meter (this one is from <a href="https://www.amazon.com/Keweisi-Charger-Detector-Battery-Capacity/dp/B0184Y14SK" target="_blank">Keweisi</a>).</p>
                      <span class="image object">
                      <img src="../images/measurements-tool.jpg" alt="..." />
                      </span>

                      <p>But before measuring the power of the output devices, we made a little test/game : separate the output devices from the input devices.</p>

                      <p>I did pretty well : one mistake + some could've been in both categories.</p>

                      <span class="image object">
                      <img src="../images/input-output-test.jpg" alt="..." />
                      </span>

                      <br>

                      <span class="image object">
                      <img src="../images/input-output-test-corr.jpg" alt="..." />
                      </span>

                      <h4>Input vs Output devices</h4>

                      <span class="image object">
                      <img src="../images/input-output-devices.jpg" alt="..." />
                        <thead>
                          <tr>
                            <th scope="col">Input</th>
                            <th scope="col">Output</th>
                          </tr>
                        </thead>
                            <td scope="row">Temp</td>
                            <td>7 color flash</td>
                            <td scope="row">Tilt switch</td>
                            <td>2 color LED</td>
                            <td scope="row">Touch</td>
                            <td>Big sound</td>
                            <td scope="row">Analog temp</td>
                            <td>Laser emit</td>
                            <td scope="row">Heartbeat</td>
                            <td>Heartbeat</td>
                            <td scope="row">Light cup</td>
                            <td>Light cup</td>
                            <td scope="row">Ball switch</td>
                            <td>Buzzer</td>
                            <td scope="row">Hall magnatic</td>
                            <td>IR emission</td>
                            <td scope="row">Reed switch</td>
                            <td>Small sound</td>
                            <td scope="row">Tracking</td>
                            <td>Tracking</td>
                            <td scope="row">Photoresistor</td>
                            <td>2 color</td>
                            <td scope="row">Button</td>
                            <td>Passive buzzer</td>
                            <td scope="row">Digital temp</td>
                            <td></td>
                            <td scope="row">Tap module light blocking</td>
                            <td></td>
                            <td scope="row">Analog hall</td>
                            <td></td>
                          </tr>
                          <tr>
                            <td scope="row">Rotary encoder</td>
                            <td></td>
                          </tr>
                          <tr>
                            <td scope="row">Mini reed</td>
                            <td></td>
                          </tr>
                          <tr>
                            <td scope="row">Avoid</td>
                            <td></td>
                      <h4>Output tests</h4>

                      <p>To test the different output devices, we used codes that already exist on internet or in Arduino.</p>

                      <h5>LED Ring</h5>

                      <span class="image object">
                      <img src="../images/measuring-led-ring.jpg" alt="..." />
                      </span>

                      <p>For the LED ring, we used a simple code that can be found directly in Arduino.</p>

                      <p>First, we had to add the LED ring's "Adafruit NeoPixel" library.</p>

                      <p>After opening Arduino, you have to click on the library menu on the left sidebar, then search after "Adafruit NeoPixel".</p>

                      <span class="image object">
                      <img src="../images/arduino-neopixel-lib.jpg" alt="..." />
                      </span>
                      <p>Once installed, open the "File" menu, go to "Examples", scroll until you see "Adafruit NeoPixel" and choose "simple".</p>

                      <span class="image object">
                      <img src="../images/neopixel-simple-example.jpg" alt="..." />
                      </span>

                      <p><strong>The Arduino NeoPixel simple code</strong></p>

                      <pre>
                        <code>
                            // NeoPixel Ring simple sketch (c) 2013 Shae Erisson
                            // Released under the GPLv3 license to match the rest of the
                            // Adafruit NeoPixel library

                            #include < Adafruit_NeoPixel.h >
                             #include < avr/power.h > // Required for 16 MHz Adafruit Trinket
                            #endif

                            // Which pin on the Arduino is connected to the NeoPixels?
                            #define PIN        7 // On Trinket or Gemma, suggest changing this to 1

                            // How many NeoPixels are attached to the Arduino?
                            #define NUMPIXELS 16 // Popular NeoPixel ring size

                            // When setting up the NeoPixel library, we tell it how many pixels,
                            // and which pin to use to send signals. Note that for older NeoPixel
                            // strips you might need to change the third parameter -- see the
                            // strandtest example for more information on possible values.
                            Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

                            #define DELAYVAL 1500 // Time (in milliseconds) to pause between pixels

                            void setup() {
                              // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
                              // Any other board, you can remove this part (but no harm leaving it):
                            #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
                              clock_prescale_set(clock_div_1);
                            #endif
                              // END of Trinket-specific code.

                              pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
                            }

                            void loop() {
                              pixels.clear(); // Set all pixel colors to 'off'

                              // The first NeoPixel in a strand is #0, second is 1, all the way up
                              // to the count of pixels minus one.
                              for(int i=0; i < NUMPIXELS; i++) { // For each pixel...

                                // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
                                // Here we're using a moderately bright green color:
                                pixels.setPixelColor(i, pixels.Color(0, 150, 0));

                                pixels.show();   // Send the updated pixel colors to the hardware.

                                delay(DELAYVAL); // Pause before next pass through loop
                              }
                            }
                        </code>
                      </pre>

                      <blockquote>
                      <p>Think about changing the number of the pin that is linked to the ring.</p>
                      </blockquote>
                      <p>The result is the LED ring getting each LED to turn on one after another until the last one. Then it starts again from the beginning.</p>

                      <span class="object">
                      <video width="600" height="300" controls>
                      <source src="../images/led-ring-too-fast.mp4" type="video/mp4">
                      </video>
                      </span>

                      <br>

                      <h5>Servo motor</h5>

                      <p>Second test, moving a servo motor.</p>

                      <p>For this we tried out the "sweep" example from Arduino (File>Examples>Servo>Sweep).</p>

                        <code class="arduino">
                          /* Sweep
                         by BARRAGAN < http://barraganstudio.com >
                         This example code is in the public domain.

                         modified 8 Nov 2013
                         by Scott Fitzgerald
                         https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
                        */

                        #include < Servo.h >

                        Servo myservo;  // create servo object to control a servo
                        // twelve servo objects can be created on most boards

                        int pos = 0;    // variable to store the servo position

                        void setup() {
                          myservo.attach(4);  // attaches the servo on pin ... to the servo object
                        }

                        void loop() {
                          for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
                            // in steps of 1 degree
                            myservo.write(pos);              // tell servo to go to position in variable 'pos'
                            delay(15);                       // waits 15 ms for the servo to reach the position
                          }
                          for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
                            myservo.write(pos);              // tell servo to go to position in variable 'pos'
                            delay(15);                       // waits 15 ms for the servo to reach the position
                          }
                        }

                      <span class="object">
                      <video width="600" height="300" controls>
                      <source src="../images/servo-motor.mp4" type="video/mp4">
                      </video>
                      </span>

                      <br>

                      <h5>OLED Display</h5>

                      <p>As third test, we used an <a href="https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/" target="_blank">I2C OLED Display</a>.</p>

                      <p>To be more precise, we used the SSD1306 model: a monocolor, 0.96-inch display with 128×64 pixels.</p>

                      <p>To be able to use it with Arduino, we had to install 2 libraries :</p>

                      <ul>
                        <li>Adafruit SSD1306</li>
                        <li>Adafruit GFX Library</li>
                      </ul>

                      <p>Once both libraries are installed, we copy/paste <strong>the <a href="https://www.makerguides.com/how-to-interface-the-ssd1306-i2c-oled-graphic-display-with-arduino/" target="_blank">Makerguides I2C OLED Display Code for Arduino</a></strong> found on internet.</p>

                      <p>I wanted to paste the code used on the OLED display here but it is interfering with the website.</p>

                      <p>So the code file can be downloaded <a href="../files/screen.ino" target="_blank">here</a></p>

                      <p>This code shows different texts and images on the display, so that we can see what can be done with this display.</p>

                      <blockquote>
                      <p>Think about changing the number of the pin that is linked to the display.</p>
                      </blockquote>

                      <span class="object">
                      <video width="600" height="300" controls>
                      <source src="../images/screen-makerguides.mp4" type="video/mp4">
                      <h5>Buzzer</h5>
                      <p>Last, but not least, I tried out a buzzer and several musics found on <a href="https://github.com/robsoncouto/arduino-songs/tree/master" target="_blank">robsoncouto github page</a>.</p>
                      <p>I just displayed 2 of them on this page and you should easily recognize them ! ;)</p>
                      <span class="object">
                      <video width="600" height="300" controls>
                      <source src="../images/buzzer-Super-Mario-Bros.mp4" type="video/mp4">
                      </video>
                      <p>Link to our <a href="https://fabacademy.org/2024/labs/fabc/group-assignment/week009/" target="_blank">Group page</a></p>

                    </section>

                      <hr>

                    <section>
                      <h3>Files and resources</h3>
                      
                      <p><strong>My files</strong></p>
                      <ul>
                        <li><a href="../files/neopixel-simple.ino" target="_blank">LED Ring simple code</a></li>
                        <li><a href="../files/servo-sweep/servo-Sweep.ino" target="_blank">Servo Motor Sweep code</a></li>
                        <li><a href="../files/screen.ino" target="_blank">Makerguides' Screen display code</a></li>
                        <li><a href="../files/gameofthrones.ino" target="_blank">Game Of Thrones song code</a></li>
                        <li><a href="../files/super-mario-bros.ino" target="_blank">Super Mario Bros song code</a></li>
                      </ul>

                      <p><strong>Resources</strong></p>
                      <ul>
                        <li><a href="https://www.makerguides.com/" target="_blank">Makerguides website</li>
                        <li><a href="https://github.com/robsoncouto/arduino-songs/tree/master" target="_blank">robsoncouto github page</a></li>
                        <li><a href="https://fabacademy.org/2024/labs/fabc/" target="_blank">Our group page</a></li>
                      </ul>
                    </section>
                  </div>
                </section>

            </div>
          </div>

          <!-- Sidebar -->
          <div id="sidebar">
            <div class="inner">

              <!-- Menu -->
                <nav id="menu">
                  <header class="major">
                    <h2>Menu</h2>
                  </header>
                  <ul>
                    <li><a href="../index.html">Homepage</a></li>
                    <li><a href="../assignments.html">Assignments</a></li>
                      <li>
                        <span class="opener">Week per week</span>
                        <ul>
                          <li><a href="../assignments/week01.html">1. Project Management</a></li>
                          <li><a href="../assignments/week02.html">2. Computer Aided Design</a></li>
                          <li><a href="../assignments/week03.html">3. Computer Controlled Cutting</a></li>
                          <li><a href="../assignments/week04.html">4. Electronics Production</a></li>
                          <li><a href="../assignments/week05.html">5. 3D Scanning And Printing</a></li>
                          <li><a href="../assignments/week06.html">6. Embedded Programming</a></li>
                          <li><a href="../assignments/week07.html">7. Computer Controlled Machining</a></li>
                          <li><a href="../assignments/week08.html">8. Electronics Design</a></li>
                          <li><a href="../assignments/week09.html">9. Output Devices</a></li>
                          <li><a href="../assignments/week10.html">10. Mechanical Design And Machine Design</a></li>
                          <li><a href="../assignments/week11.html">11. Input Devices</a></li>
                          <li><a href="../assignments/week12.html">12. Molding and Casting</a></li>
                          <li><a href="../assignments/week13.html">13. Networking And Communications</a></li>
                          <li><a href="../assignments/week14.html">14. Interface And Application Programming</a></li>
                          <li><a href="../assignments/week15.html">15. Wildcard Week</a></li>
                          <li><a href="../assignments/week16.html">16. Applications And Implications</a></li>
                          <li><a href="../assignments/week17.html">17. Invention, Intellectual Property And Income</a></li>
                          <li><a href="../assignments/week18.html">18. Project Development</a></li>
                        </ul>
                    </li>
                    <li><a href="../final-project.html">Final Project</a></li>
                    
                    <li><a href="../about.html">About Me</a></li>
                </nav>

              <!-- Footer -->
                <footer id="footer">
                  <p class="copyright">&copy; Charlotte - FabLab de Charleroi. Fab Academy 2024. All rights reserved. Design: <a href="https://html5up.net">HTML5 UP</a>.</p>
                </footer>

            </div>
          </div>

      </div>

    <!-- Scripts -->
      <script src="../assets/js/jquery.min.js"></script>
      <script src="../assets/js/browser.min.js"></script>
      <script src="../assets/js/breakpoints.min.js"></script>
      <script src="../assets/js/util.js"></script>
      <script src="../assets/js/main.js"></script>

  </body>
</html>