【Spherical Robot: Arduino学习笔记】(TBC)

发布于:2022-12-02 ⋅ 阅读:(339) ⋅ 点赞:(0)

IC3103学习笔记
课件引用于香港理工大学IC3103课程

Spherical Robot

  1. Market Research
  2. Product design (Procreate/ Solidwork/ AutoCAD/ SketchUp)
  3. Eletronic: Arduino

Circuit

Ohm’s Law
请添加图片描述

V = I*R
where, V = Voltage (V); I = Current (A); R = Resistance (Ohms)

请添加图片描述

Electronic Signals

请添加图片描述

Signal which are continuous as time varying in nature are analog signals.
Signal which are discrete are called digital signals.

Analog signal is a form of electrical energy (voltage, current or electromagnetic power) for which there is a linear relationship between electrical quantity and the value that the signal represents.

Analog Signals
– Voltage(e.g. 0-5V)
– Current(e.g. 0-20mA)

The signal, whose amplitude takes only limited values is called Digital signal. Digital signal are discrete, they contain only distinct values.

Digital Signals
– I/O:1(High),0(Low),Pulse
– Bus (IO groups)

Input Devices

Sense the environment
• Digital Sensor
• Analog Sensor

请添加图片描述

请添加图片描述

请添加图片描述

请添加图片描述

请添加图片描述

Output Devices

Affect the surroundings
• Digital Actuators
• Analog Actuators

请添加图片描述

请添加图片描述
请添加图片描述

请添加图片描述

Process Module

Receiving input and controlling output

Digital System(Internal)
Analog to Digital Convert

• (e.g. 0~5V Signal)
0.0V  000
2.5V  050
5.0V  100

请添加图片描述

Big Arduino

请添加图片描述

Small Arduino

请添加图片描述

请添加图片描述

请添加图片描述

Electronic system Power

Power Adapter or Battery
• Power Adapter for hi power system.
• Battery for portable system.
• Rechargeable: NiMH/ Li-Ion/ Pb-Ac /SuperCap
• Non-Rechargeable: Alkaline Battery/ Li-ion*

Power Arduino Board
• From USB: DC5V, Max current 500mA
• From Ext DC PWR Jack: DC6-12V
• AAx4 Battery Box • USB Portable Power Supply

Procedure of build ELE system prototype

  1. Get an idea.
  2. Build minimize system as verify platform.
  3. Verify main function.
  4. Assemble ELE components into prototype.
  5. Test the full function prototype.

Arduino Basic Programming

请添加图片描述

Comments: created with // or /* and */
Operators: = is used to assign a value; == is used to compare values
And & Or: && is “and” || is “or”

Serial.begin() 1: Tx 0: Rx (Reserved for bluetooth transformation)

The serial communication is a simple scheme that uses the UART (Universal Asynchronous Receiver/Transmitter) on the Microcontroller. It uses,
5V for logic 1 (high)
0V for logic 0 (low)

For a 3.3V board, it uses
3V for logic 1 (high)
0V for logic 0 (low)

The messages sent to the computer from Arduino are sent from PIN 1 of the Arduino board, called Tx (Transmitter). The messages being sent to the Arduino from the computer are received on PIN 0, called Rx (Receiver).

There are five pins present on the USB-to serial adapter, including RX, TX, reset button, and GND (Ground).
在这里插入图片描述

void setup ( )  
{  
Serial.begin(4800);   
}  
void loop ( )  
{  
}  

Serial.print()

Serial.print( value, format )


It specifies the base format and gives the output according to the specified format. It includes the formats Octal -OCT (base 8), Binary-BIN (base 2), Decimal-DEC (base 10), and Hexadecimal-HEX (base 16)

Serial.printIn()

Printed in a new line

void setup ( )  
{   
Serial.begin ( 4800);  
}  
void loop ( )  
{  
Serial.print(" Hello");  
delay(1000);     
Serial.println("Arduino");  // It will print Arduino followed by a new line.  
delay ( 1500);  // delay of 1.5 seconds between each printed line.  
}  

Serial.available()

Printed only when something statement has been fulfilled

int arrivingdatabyte = 0; // initializing the incoming serial byte  
void setup( )  
{  
Serial.begin(9600); // 9600 is the data rate in bps (bits per second).  
}  
void loop( ) // loop function that executes repeatedly  
{  
if(Serial.available( ) > 0) //  It will only send data when the received data is greater than 0.  
{  
arrivingdatabyte = Serial.read( );  // It will read the incoming or arriving data byte  
Serial.print("data byte received:");  
Serial.println(arrivingdatabyte, DEC); // here, DEC means Decimal  
}  
}  

Serial.analogRead()

The analogRead( ) function reads the value from the specified analog pin present on the particular Arduino board.

  // Below is an example for the better understanding of the analogRead( ) function   
 int AnaPin = A3; // Analog pin A3 is specified here  
int value = 0;  // variable declared to store the value read  
void setup()   
{  
  Serial.begin(9600);           //  It sets the serial rate at bps  
}  
void loop()   
{  
  value = analogRead(AnaPin);  // It reads the input pin    
  Serial.println(value);            
}  

setup()

Basic variable types:
Boolean (A boolean holds one of two values, true or false.)

void setup ( ) { }
// The setup function comes before the loop function and is necessary for all Arduino sketches]

void setup ( ) { pinMode (13, OUTPUT); }
// Outputs are declare in setup, this is done by using the pinMode function

void setup ( ) { Serial.begin(9600); }
// This particular example declares Serial communication at a baud rate of 960

Integer
Character

if()

if ( this is true ) { do this; }

if else

else { do this; }

请添加图片描述

loop: for while

void loop ( ) { }

请添加图片描述

for loop

for (int count = 0; count<10; count++) {
//for action code goes here
//this could be anything
}

请添加图片描述

while()

while ( count<10 ) {
//while action code goes here //should include a way to change count //variable so the computer is not stuck //inside the while loop forever
}

IO

Output
• Digital Write

digitalWrite ( pinNumber, value ) ;
// pinNumber can be any PWM pins (D0 to D13) value is either HIGH (ON/1) and LOW (OFF/0)

• Analog Write

analogWrite ( pinNumber, value ) ;
// pinNumber can be any PWM pins value is between 255 (100%) and 0 (0%)

3 6 9 10 11

Input
• Digital Read

digitalRead ( pinNumber) ;
// pinNumber can be any digital pins (D0 to D13) Return value is either HIGH (ON/1) or LOW (OFF/0)

pinMode (pinNumber, mode) ;
// pinNumber can be any digital pins (D0 to D13) mode: INPUT_PULLUP

• Analog Read

analogRead ( pinNumber) ;
// pinNumber can be any analog pins (A0 to A12) Return value is between 1023 (100%) and 0 (0%)

请添加图片描述

Delay Time

Delay milliseconds (1ms = 0.001s) delay( ms ) ;
ms type: unsigned long, range: 0 to 4,294,967,295
请添加图片描述

Delay microseconds (1us = 0.000001s) delayMicrosenconds( us ) ; us type: unsigned int, range: 0 to 16383

Electronic Component

请添加图片描述

请添加图片描述

Resistor

请添加图片描述

Capacitor

请添加图片描述

Diode (二極管)

请添加图片描述

Button (按鍵)

请添加图片描述

Transistor (晶體管)

请添加图片描述

IC – Integrated Circuit (集成電路)

请添加图片描述

Status of Connection

  1. Open Circuit
  2. Closed Circuit
  3. Short Circuit

Types of waveforms

请添加图片描述

DC Motor

DC Motor (Direct Current Motor)
• Continue Rotation
• Easy to drive
Speed Control
• DC Voltage
Output Torque
• Current

2 Type of DC Motor
Brush DC Motor
• 2 Pins: +/-
• Easy to drive
Brushless DC Motor
• 3 Pins: A/B/C
• High efficiency

Input IAx/IBx, Output OAx/Obx

请添加图片描述

请添加图片描述

Bluetooth

请添加图片描述

请添加图片描述

Soldering/Desoldering

请添加图片描述

请添加图片描述

请添加图片描述

Plastic Appreciation

UV (Inkjet) Printer Outlook

请添加图片描述

  1. Attached a paper on table
  2. Printed the image onto the paper
  3. Image Printed onto Object

Vacuum Former

请添加图片描述

  1. Place the forming mold on the former
  2. Put the plastic sheet on the frame
  3. Heat up the plastic sheet to soften
  4. Power on the vacuum pump for forming

请添加图片描述

High Frequency Welding

请添加图片描述

请添加图片描述

Some Useful Website

Arduino

CircuitBasics

ResistorCalculator

Tinkercad


网站公告

今日签到

点亮在社区的每一天
去签到