Menu Back

Second class assignment

h3>Open Source Hardware

Define:

Source hardware refers to physical artifacts of technology designed and offered in the same manner as free and open-source software. Open source hardware gives people the freedom to control their technology while sharing knowledge and encouraging commerce through the open exchange of designs.

pic

License:

The GNU General Public License (GPL)

The GNU General Public License (GPL) is a widely used Free Software license developed and distributed by the Free Software Foundation (FSF). It is designed to protect the freedom of software users by ensuring that users can freely run, learn, modify and distribute software, including any modified version based on that software. The core principle of the GPL is "Copyleft," a legal strategy that is the antithesis of the traditional concept of copyright, requiring that when software is distributed in any form, its source code must remain publicly available and be distributed with the same license terms, ensuring that downstream recipients have the same rights as the original recipients.

pic

features of the GPL:

a.Free distribution: Allows anyone to obtain a copy of the software, including the source code, for free and can be redistributed without restriction.

b.Open source code: Anyone distributing software must provide the source code or provide a way to access the source code.

c.License compatibility of derivative works: If GPL-licensed software is modified and distributed, the modified software must also be distributed under the GPL, ensuring that derivative works remain free as well.

d.Copyleft contagiousness: This term describes a unique nature of the GPL license, namely that once part of the software is under the GPL, the entire software (if combined or linked) usually must also be released under the GPL. This is in contrast to more lenient licenses such as the LGPL (GNU Less Lenient Public License) or the MIT License, which do not force downstream works to adopt the same license.

e.License for Commercial Use: Although the GPL guarantees the free use of software, it does not prohibit the software from being used for commercial purposes. Companies can sell software under the GPL as long as they comply with all conditions of the license.

f.Multiple versions: Since its first release in 1989, the GPL has gone through multiple iterations, the latest being Version 3 (GPLv3), which was released in 2007 to address new challenges in the software world, such as software patents and digital rights management (DRM).

well-known free and open source software projects, including the Linux operating system kernel, have adopted the GPL as their license, which has facilitated free software collaboration and innovation worldwide.

Example:

Raspberry Pi

The Raspberry Pi is a miniature computer developed by the UK registered "Raspberry Pi Charitable Foundation", designed to educate and learn computer programming. It's the size of a credit card, but it contains all the basic functions of a computer. The Raspberry PI is based on Linux, but can also run operating systems such as Windows 10 IoT, making it versatile.
pic
Raspberry PI features include:

a.Size and appearance: Only the size of a credit card, it can connect to a keyboard, mouse and cable, and connect to a monitor or TV through an HDMI port. pic

b.Functions: With video, audio output and other basic functions, you can edit Office documents, browse the web, play games and so on.

c.Memory and storage: Initially using SD/MicroSD cards as memory and hard disk, later models offer different size memory configurations such as 256MB, 512MB, 1GB, etc. pic

d.Widely used: widely used in industrial scenarios, Internet of things , smart agriculture, artificial intelligence, new energy and other fields.

e.Educational purpose: The Raspberry PI Foundation hopes this computer will promote computer science education and make computers fun in different countries. pic

f.Programming language support: Python, Scratch, C++, JavaScript and other programming languages.

g.Media Center: By connecting the TV or monitor, using the corresponding operating system and media playback software, it can be transformed into a multimedia center.

h.Iot applications: Suitable for use in iot applications, connecting to various sensors and devices, collecting data and analyzing it.

i.Educational and research experiments: used in schools and universities to teach computer science, electrical engineering and other courses, or used in research projects. pic pic

Raspberry PI models include Model A, Model A+, Model B, Model B+, Model 2, Model 3, Model 3, Model 3, Compute Module, and Model 4, with performance and features varying by model.

pic pic pic pic pic

Learn the Arduino IDE,coding method,hardware connect

·Arduino IDE

The Arduino IDE is an open-source integrated development environment for writing and uploading code to Arduino microcontroller boards. It provides an easy-to-use programming environment that allows you to write code for controlling and operating hardware. The Arduino programming language is based on the Processing language and is inspired by the Wiring framework, both of which are programming languages designed for artists and hobbyists.
pic

·Encoding Method

When you open the Arduino IDE, you'll see that there are two basic functions:

·setup(): This function is called once each time the power supply is powered to the Arduino board. It is mainly used to initialize variables, set pin patterns, start using library files, etc.
·loop(): After setup(), the loop() function is called repeatedly, forming the main loop of the program. Here, you can continuously read sensor data, control motors, update displays, etc.

void setup() {
    // 初始化代码
  }

void loop() {
    // 持续运行的代码
  }
Writing Arduino code typically involves setting up pin modes (input, output, input pull-ups) and then reading or writing to those pins, as well as optionally using serial communication to debug the code.v

    int ledPin = 13;

    void setup() {
      pinMode(ledPin, OUTPUT);
    }
    
    void loop() {
      digitalWrite(ledPin, HIGH);   // 打开LED
      delay(1000);                  // 等待一秒钟
      digitalWrite(ledPin, LOW);    // 关闭LED
      delay(1000);                  // 等待一秒钟
    }
    
pic
https://img-blog.csdnimg.cn/20200920200706577.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xod2FuZ2xlaQ==,size_16,color_FFFFFF,t_70#pic_center

·Hardware connections

The Arduino microcontroller board is connected via multiple pins, which can be digital, analog, PWM, or specifically for communication. Depending on the program you write and the hardware you need to connect, you can connect components such as LEDs, sensors, motors, and more to these pins. Often, you'll also need to consider proper power management and possible electrical isolation.
The steps to connect the hardware typically include:
1.Physically insert the component into the correct pins of an Arduino board or breadboard (depending on your project and design).

pic
https://th.bing.com/th/id/R.f19fdfa3e3347169866437b228520dae?rik=uOhY5UiGopltzw&pid=ImgRaw&r=0

2.Use jumpers to connect the component pins to the Arduino pins.

pic
https://th.bing.com/th/id/OIP.LTXSmwuymCoyzvDOU0ofiwHaHa?rs=1&pid=ImgDetMain

3.Ensure proper power and ground connections are provided.

pic
https://th.bing.com/th/id/OIP.K1ZjvdyF6rXEFL3NaVuq9gAAAA?rs=1&pid=ImgDetMain

4.For some components, such as motors and relays, external power supplies and protection components such as diodes and transistors may also be required.

pic
https://hackster.imgix.net/uploads/attachments/1281448/captura_de_tela_de_2021-04-03_15-41-48_HlcQ4TdNQ8.png
Once the connection is complete, connect the Arduino to your computer via a USB cable and upload the code via the Arduino IDE.
When designing circuits and writing code, it's important to follow good engineering practices to ensure that circuits are safe and reliable.

Own case: Motor Control

This experiment utilizes an Arduino board to manipulate a servo motor. The motor will sweep back and forth, pausing for a second at each of the positions - 0, 40, and 80 degrees.

Required Materials:

1. Arduino Development Board

2. Servo Motor

3. Jumper Wires

Circuit Connection Method:

Before connecting the servo, it is essential to comprehend the control mechanism:

Servo motors are essentially low-cost servo motor systems and work by receiving PWM pulse modulation signaling through their internal circuitry. This signal controls the movement of the inbuilt motor, which in turn engages a series of reduction gears, transferring torque to the output shaft. A potentiometer connected to the output shaft gives feedback on position, enabling precise motor positioning.

Construction Process:

Tinkercad design diagram

The SG90 servo has three wires: the power wire (red), ground wire (black or brown), and signal wire (yellow, orange, or white).

After connections are made, upload the following code to the Arduino board:

Tinkercad design diagram
        
        #include <Servo.h>

        #define PIN_SERVO 10
        Servo myservo;

        void setup() 
        { 
          myservo.attach(PIN_SERVO); 
        }

        void loop() 
        { 
          myservo.write(0);
          delay(1000); 
          myservo.write(40);
          delay(1000); 
          myservo.write(80);
          delay(1000); 
          myservo.write(40);
          delay(1000); 
          myservo.write(0);
          delay(1000);
        }
        
        

Tinkercad drawing and production process

Creating circuit diagrams using Tinkercad can very visually show the design of the entire project. This process can help understand how each component is connected and provide a visual guide for creating a physical prototype. You can be in the here to check the detailed steps.

Tinkercad design diagram Tinkercad advanced design diagram Tinkercad final design

Show

Once the code is uploaded to the Arduino board, the servo motor should actuate accordingly, pausing at the specified positions of 0, 40, and 80 degrees for one second each.

Conclusion:

This experiment demonstrates precise servo motor control using an Arduino. Simple code instructions enable the manipulation of motor movements between pre-specified positions. This is an insightful experiment for understanding the principles of servo motors and programming them for precision control.

Water light effect implementation

This code belongs to an example program that uses Arduino to control the NeoPixel LED light strip. Arduino is an easy to use and open source electronic prototyping platform, while NeoPixel is a series of LED products produced by Adafruit Industries that have built-in WS2811/WS2812 driver chips that individually control the color and brightness of each LED.

water light effect: the unlit lights are lit one by one, and then gradually extinguished from the beginning end, you can cycle, of course, you can also have other effects, you can set yourself.

Materials needed:

1. Arduino UNO

2. Jumper

3. WS2812B RGB LED ring or NeoPixel LED light strip

Arduino application process

Before you start programming, you need to install the Adafruit_NeoPixel library. It can be found and installed in "Library Manager" in the Arduino IDE.

Arduino IDE库管理器

Install Adafruit_NeoPixel library file

In the Arduino IDE, click on "Tools" -> "Manage Library..." ", then type "Adafruit NeoPixel" in the search box, find it and click "Install".

安装Adafruit_NeoPixel库

Open sample file

After installing the library file, select the sample you want to open in "File" -> "Example" -> "Adafruit NeoPixel".

打开示例文件 打开示例文件

Modify the file according to the characteristics of the equipment

An LED strip with eight beads is used here, so the number of leds in the code and possible pin numbers need to be modified according to the actual device.

根据器材修正文件

Programming environment:

Arduino IDE

          
          // A basic everyday NeoPixel strip test program.
          
          // NEOPIXEL BEST PRACTICES for most reliable operation:
          // - Add 1000 uF CAPACITOR between NeoPixel strip's + and - connections.
          // - MINIMIZE WIRING LENGTH between microcontroller board and first pixel.
          // - NeoPixel strip's DATA-IN should pass through a 300-500 OHM RESISTOR.
          // - AVOID connecting NeoPixels on a LIVE CIRCUIT. If you must, ALWAYS
          //   connect GROUND (-) first, then +, then data.
          // - When using a 3.3V microcontroller with a 5V-powered NeoPixel strip,
          //   a LOGIC-LEVEL CONVERTER on the data line is STRONGLY RECOMMENDED.
          // (Skipping these may work OK on your workbench but can fail in the field)
          
          #include <Adafruit_NeoPixel.h>
          #ifdef __AVR__
           #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
          #endif
          
          // Which pin on the Arduino is connected to the NeoPixels?
          // On a Trinket or Gemma we suggest changing this to 1:
          #define LED_PIN    6
          
          // How many NeoPixels are attached to the Arduino?
          #define LED_COUNT 60
          
          // Declare our NeoPixel strip object:
          Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
          // Argument 1 = Number of pixels in NeoPixel strip
          // Argument 2 = Arduino pin number (most are valid)
          // Argument 3 = Pixel type flags, add together as needed:
          //   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
          //   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
          //   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
          //   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
          //   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
          
          // setup() function -- runs once at startup --------------------------------
          
          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.
          
            strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
            strip.show();            // Turn OFF all pixels ASAP
            strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
          }
          
          // loop() function -- runs repeatedly as long as board is on ---------------
          
          void loop() {
            // Fill along the length of the strip in various colors...
            colorWipe(strip.Color(255,   0,   0), 50); // Red
            colorWipe(strip.Color(  0, 255,   0), 50); // Green
            colorWipe(strip.Color(  0,   0, 255), 50); // Blue
          
            // Do a theater marquee effect in various colors...
            theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
            theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
            theaterChase(strip.Color(  0,   0, 127), 50); // Blue, half brightness
          
            rainbow(10);             // Flowing rainbow cycle along the whole strip
            theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
          }
          
          // Some functions of our own for creating animated effects -----------------
          
          // Fill strip pixels one after another with a color. Strip is NOT cleared
          // first; anything there will be covered pixel by pixel. Pass in color
          // (as a single 'packed' 32-bit value, which you can get by calling
          // strip.Color(red, green, blue) as shown in the loop() function above),
          // and a delay time (in milliseconds) between pixels.
          void colorWipe(uint32_t color, int wait) {
            for(int i=0; i RGB
                  strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
                }
                strip.show();                // Update strip with new contents
                delay(wait);                 // Pause for a moment
                firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
              }
            }
          }
          
          

The main elements include:

  1. Adafruit_NeoPixel library: This library provides an easy to use interface to control the LED lamp beads of the WS2811/WS2812 model.

  2. Preprocessor instruction:
    #include < Adafruit_NeoPixel.h>
    This is the C++ preprocessor instruction used to include the Adafruit NeoPixel library so that the functionality provided by the library can be used in your program.

  3. Pin definition:
    #define LED_PIN 6
    Define the pin number on the Arduino board to connect NeoPixel. In this code, the data signal line is connected to digital pin 6.

  4. LED number definition:
    #define LED_COUNT 8
    Defines the number of NeoPixel lamp beads attached to the Arduino board.

  5. NeoPixel object initialization:
    Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
    This line of code creates a new Adafruit_NeoPixel object, which represents the entire LED strip you control.

  6. setup function (setup) :
    void setup()
    Is the part of the code that runs only once when the Arduino board is started. Initializes the NeoPixel object and sets the brightness of the LED.

  7. Main loop function (loop) :
    void loop()
    Includes various animation effects that control LED strips, such as "colorWipe" and "theaterChase." These functions are included in the main program loop and are called through the loop to create the animation effect.

  8. Custom function:
    void colorWipe(uint32_t color, int wait)
    Etc., is a custom function written to create animation effects. For example, the colorWipe function changes the color of the LED lights one by one, and theaterChase creates a running horselight effect.

Tinkercad drawing and production process

Creating circuit diagrams using Tinkercad can very visually show the design of the entire project. This process can help understand how each component is connected and provide a visual guide for creating a physical prototype. You can be in the here to check the detailed steps.

Tinkercad设计图 Tinkercad进阶设计图 Tinkercad最终设计图

Show

Once the code has been uploaded to the Arduino board, the LED strip should display the set water light effect. This process may require some tuning, but as you make adjustments in the code, you will see different lighting effects.

Water Light Effect

Examples of open source projects

1. Bookshelf Light pic

STEP-1 : 3D print the attached files.

STEP-2 : Follow the wiring diagram to create the electrical circuit.

STEP-3 : Make a book cover.

STEP-4 : Set up and Light up.

pic

2. AI self driving car.

STEP-1 : Description and Scope of the Project Part One: Mechanical Components Part Two: Electronic Components Part Three: Treadmill

STEP-2 :

DESIGN BASIS pic

The construction of the car must be carried out on a chassis of a low-cost 1/10 scale model that can be easily acquired. The motor must be a brushless motor and model 550. The car must be able to be handled in two ways: a manual one through a radio control transmitter and an automatic one, where the car is guided by means of a computer. The car must be equipped with vision cameras and lights.

STEP-3 :

Design Recommendations - BEFORE STARTING 3D PRINTING Efficient 3D Design: Use 3D design software like SolidWorks, Fusion 360, Tinkercad, or Blender to create your model. Print Orientation: Plan the orientation of the part on the 3D printer to minimize the need for supports. Printing Material: Choose a suitable material for your application. Wall Thickness and Infill: Adjust the wall thickness and infill of your design according to your needs.  Easy Assembly: Design parts that are easy to assemble without the need for additional tools. Consider Tolerances: Take into account tolerances to ensure that the printed parts fit together properly.  Modular Structure: Divide the structure into smaller modules that can be printed separately and then assembled.  Iterative Testing: Prototype and test with 3D-printed parts before printing the complete structure.  Documentation: Document your design in detail. Provide clear assembly instructions, a parts list, and any additional information that might be useful for others looking to build the same robot. Consider Functionality: Ensure that the structure can accommodate all necessary components. Strategic Reinforcements: If needed, you can add reinforcements in critical areas of the structure to increase strength and durability. Optimize for Weight: If mobility is a significant factor, look for ways to optimize the weight of the structure without compromising strength. Respect Copyrights: If you are using pre-existing designs or third-party components, make sure to respect copyrights and relevant licenses.

STEP-4 :

3D PRINTING: Grille-Front Bumper, Cameras Support & Sensor Support pic

STEP-5 :

3D PRINTING: Battery Holder pic

STEP-6 :

3D PRINTING: Electronic Components Base

STEP-7 :

3D PRINTING: Rear Lights

STEP8 :

3D PRINTING: Car Treadmill pic

STEP-9 :

3D PRINTING: Post Processing

STEP-10 :

POST PROCESSING
Use a Straight Rectangular File for Coarse Finish, 8" Long x 1/2" Wide to remove excess plastic. Use a HSS Straight Groove Step Drill Bit 3-12mm to drill the holes for the M3 screws to go through.
pic

STEP-11:

HEAT SET INSERTS
Carefully using the insertion tool, install the insertion nuts as shown in the pictures.

STEP-12 :

PLACING HEXAGONAL SPACERS
Install the M3 Male Female Hex Spacers Standoff Screw as shown in the pictures.

STEP-13 :

COMPONENT DESCRIPTION: Raspberry Pi 4 pic

STEP-14 :

COMPONENT DESCRIPTION: Wemos D1 R32 pic

STEP-15:

COMPONENT DESCRIPTION: Synchronized Dual Lens Stereo USB Camera

STEP-16 :

COMPONENT DESCRIPTION: Cables

STEP-17 :

COMPONENT DESCRIPTION: Raspberry Camera & Fisheye Lens pic

STEP-18 :

COMPONENT DESCRIPTION: Motor & Controller pic

STEP-19 :

COMPONENT DESCRIPTION: Google Coral USB Accelerator

STEP-20 :

PLACING DECALS & REINFORCING THE CAR BODY

STEP-21 :

CUTTING HOLES: Grille pic

STEP-22 :

CUTTING HOLES: Rear Lights

STEP-23 :

OPTION A: Mounting the SHARP Distance Sensor pic STEP-24 :

OPTION B: Mounting the Laser Distance Sensor

STEP-25 :

Installing the Grille (OPTION A) and Cameras Together pic

STEP-26 :

Before Starting to Assemble: ELECTRICAL SYSTEM

STEP-27 :

ELECTRICAL SYSTEM: Switch & StepDown Converter

STEP-28 :

ELECTRICAL SYSTEM: Battery Wiring

STEP-29 :

ELECTRICAL SYSTEM: Regulator & Switch Wiring

STEP-30 :

ELECTRICAL SYSTEM: Voltage Adjusting

STEP-31:

ELECTRICAL SYSTEM: Battery Wiring for Motor

STEP-32 :

ELECTRICAL SYSTEM: Gluing the Battery Holder

STEP-33 :

ELECTRICAL SYSTEM: SOLDERING USB TYPE C CONNECTOR

STEP-34 :

 HSP 94123
If you choose the unassembled version and have not assembled such a vehicle before, it may seem like a difficult task. If this is your case, I recommend that you watch the following video, which shows how to assemble this model. It is in Spanish but you can set the subtitles to English.
pic

STEP-35 :

HSP 94123: FRONT SUSPENCION

STEP-36 :

FRONT DIFERENTIAL

STEP-37 :

Front Suspension Assembly

STEP-38 :

TRANSMISION

STEP-39 :

Installing the Grille and Cameras on the Car

STEP-40 :

Rear Suspension Assembly

STEP-41 :

Rear Suspension Mounting

STEP-42 :

Mounting the ELECTRICAL SYSTEM pic

STEP-43 :

Mounting the Electronic Components Base

STEP-44 :

REAR LIGHTS

STEP-45:

REAR LIGHTS PRO (UPDATED VERSION: PCB & 3D PRINTER FILES) pic

STEP-46 :

GEARBOX ANALYSIS

STEP-47 :

Remote Control: Code Matching Steps pic

STEP-48 :

TREADMILL

STEP-49 :

TREADMILL: PVC Cutting

STEP-50 :

TREADMILL: PVC Painting

STEP-51 :

TREADMILL: Roller Assembly

STEP-52 :

TREADMILL: Roller Front Support Assembly

STEP-53 :

TREADMILL: Roller Rear Support Assembly

STEP-54 :

TREADMILL: Putting It All Together

STEP-55 :

TEST REAR LIGHTS pic

STEP-56 :

BLENDER pic pic

Advantages and disadvantages of open source.

Advantage:

Its main strengths lie in long-term trustworthiness, parallel debugging, parallel development, perfect application programming interfaces, and fast version release. even if the software is no longer developed, one can further utilize the source code.open source software open model can adopt the approach of parallel debugging and parallel research and development, allowing potential unlimited developers on the network to be used for free and simultaneously.The biggest advantage of the open source software development model is that it can receive a large number of support from the open source community, just like having a large number of free software developers and testers.

Diadvantage:

Mainly manifested as management costs, design program issues, and organizational trustworthiness.once the plan develops to a certain extent, the quality of its innovation and correction will inevitably increase.from the perspective of program design issues, the constant release of new versions will cause consumers to constantly reinstall.open source software is contributed by different community members and does not bear the responsibility of quality assurance, compared to traditional software enterprises, it is indeed possible that they may not receive comprehensive support .