顯示具有 物聯網 標籤的文章。 顯示所有文章
顯示具有 物聯網 標籤的文章。 顯示所有文章

2024年9月21日 星期六

what is Botnet ?

 

A botnet is a network of compromised computers or devices, often referred to as "bots" or "zombies," that are controlled remotely by a malicious actor (known as a "botmaster"). These devices are typically infected with malware, allowing the botmaster to execute various commands on them without the device owner’s knowledge.

Here are some common uses and dangers of botnets:

  1. Distributed Denial of Service (DDoS) Attacks: Botnets are often used to flood a target server or website with traffic, overwhelming it and causing it to crash or become unavailable to users.

  2. Spam Distribution: They can be used to send out massive amounts of spam emails or phishing messages, which can lead to further infections or fraud.

  3. Credential Stuffing: Botnets may attempt to use stolen usernames and passwords on different sites, automating the process to try many combinations quickly.



2022年6月25日 星期六

UART over TTL/RS232

 

UART 是軟體層面的 serial 通訊協議(也可以借力 UART IC來完成)。定義baudrate, start bit, stop bit , data bit, parity check 等等, 但這些0和1都是只邏輯的0和1。而實際走的硬體訊號, 則要看使用的是TTL還是 RS232。TTL和 RS232 描述的是 Physical 電氣訊號。

TTL (transistor-transistor logic) 就是定義 0V 為 0,Vcc 為 1 , 一般 MCU、SoC 都會用的方式。  RS-232 定義 -3 to -25V 為 0, 而+3V~+25V為1。不過 RS232 是一個完善的標準通訊規範,所以尚包含硬體流量控制的機制及 Connector 的型式(如DB-9) 等內容。正常的PC 用的就是RS232 界面。不過若僅僅只是做基本的傳輸,不是拿來接數據機(Modem)這類的,其實也只是用了其中3條通訊線而已,TXD, RXD, GND。現在你懂了,為何 UART over TTL 只有3條訊號線的原因。

Source image: https://components101.com/


PC(RS232)—----- UART ——MCU (5V), 因為電壓不同所以要做level shifter , 這可以使用MX232之類的IC來完成. UART over RS-232 (上) 及 UART over TTL (下) 傳送 01010101的電壓圖。總之,我送0/1, 你要解讀成0/1, 而不是解讀成1/0。
Source Image: https://www.sparkfun.com/

相關文章: 


相關課程: 
[1] Linux 驅動程式設計 -實作LINUX UART/TTY Driver
[2] ARM Boot loader 設計-實作UART
[3] MUC 韌體設計-UART驅動


2022年2月7日 星期一

關於 Raspberry Pi Pico

Raspberry Pi 基金會於 2021 年 1 月推出 Raspberry Pi Pico,正式進軍微控制器(MCU)領域。Pico 採用基金會自主設計的 RP2040 晶片,該晶片配備雙核 ARM Cortex-M0+(運行頻率最高可達 133MHz),內建 264KB SRAM 和 2MB Flash,其 GPIO 輸出為 3.3V。2024 年 11 月,基金會推出了 Raspberry Pi Pico 2 W 版本。其中「W」代表此版本內建 802.11n 無線網路功能,其核心晶片為 RP2350。


Pico 本身內建 bootloader,但不像 Raspberry Pi 或 Pi Zero 那樣運行 Linux 作業系統。為了方便開發,Raspberry Pi 基金會提供了 C/C++ SDK 和 MicroPython SDK。軟體和硬體與Raspberry Pi Pico 1相容。 Pico 也支援 TensorFlow Lite 框架,可用於開發輕量級的機器學習應用。 


 
7 × 7 mm QFN-56 package 

Raspberry Pi Pico 2的硬體規格:

    • 雙Arm Cortex-M33或雙Hazard3處理器@150MHz
    • 520 KB片上SRAM
    • 2個UART。
    • 2個SPI控制器。
    • 2個I2C控制器。
    • 24個PWM通道。
    • 4個ADC通道。
    • 1個USB 1.1控制器和PHY,支援主機和裝置。
    • 12個PIO狀態機。
    • 工作溫度-20°C至+85°C。
    • 支援輸入電壓1.8–5.5V DC。


Raspberry Pi Pico


Pi Pico 擴充板規格

由於Raspberry Pi Pico 本身並未內建任何感應器,為了使其能夠應用於物聯網(IoT)及邊緣人工智能(Edge AI)等領域,特別採用了台灣程式教育協進會開發的 Pi Pico 擴充板。該擴充板的規格如下:








Pico + Pico 擴充板的一些物聯網應用

DEMO1



DEMO2



DEMO3




DEMO4



[課程]Raspberry Pi Pico 物聯網應用實作

https://bit.ly/4hTRptE

- 理解 Raspberry Pi Pico 硬體架構與擴充功能,並能運用 GPIO、ADC、PWM 等技術進行基礎硬體控制與感測應用。
- 熟悉 Thonny IDE 與 MicroPython 程式設計,具備多執行緒與時間控制能力。。
- 能運用通訊協定與 Wi-Fi 模組實作 IoT 應用,包含資料傳輸、Web 伺服器與雙向 I/O 控制。

更多Web 技術開發課程
- JavaScript 程式設計精修 https://bit.ly/3nF7bfH
- web全端開發應用班 https://goo.gl/fjEHfT
- IoT 物聯網實務班 https://bit.ly/2XwwHcx

2020年11月17日 星期二

iPAS 物聯網應用工程師認證(葵花寶典)



0.) 關於iPAS 物聯網應用工程師考試簡介



1.) IoT 技術架構簡介
2.) IoT 通訊技術
3.) IoT Cloud平台

4) 物聯網感測層
4) 物聯網應用層 





5.)  Quick Overview



 
  6.) IoT Project Demo:

ARM mbed 物聯網平台實戰(課程節錄)
https://youtu.be/sslJLgOPfCM



ARM mbed Cloud 平台架構簡介
https://youtu.be/GrMD8Me5qg0




IoT Gateway Demo
https://youtu.be/tZFMY5UIG6s



智慧POS機-人臉自動結帳
https://youtu.be/DHTQCF6t1Jw



AIoT智能居家燈控系統
https://youtu.be/Dcz28sASv0w



Control your Raspberry Pi using Line Bot
https://youtu.be/WL2RrYrGB1Q



Iot自動販賣機
https://youtu.be/9jxIuyiIXko





2020年7月27日 星期一

DYNAMIXEL Motor 控制使用TTL

DYNAMIXEL Motor 


Dynamixel智能馬達是模組化形式,採用菊鏈多串接方式。這讓用戶可以輕鬆地更改和添加馬達關節,以獲得所需的扭力和自由度。

DYNAMIXEL Motor 有的是使用TTL,有的是使用RS485的訊號來做控制

而XL430-W250 則是使用TTL訊號來做控制

控制器 <----------TTL-------------> DYNAMIXEL Motor (XL430-W250 )

 TTL 共有3個Pin 
Data ---- 5V
VDD ---12V
GND 


所謂TTL 訊號控制可以看成是UART的半雙工模式,即出去(TX)和進來(RX) 都是走同一個TTL 的Data訊號

 UART TX -----------------------> TTL Data

 UART RX <----------------------- TTL Data


2019年1月10日 星期四

AIoT軟體架構圖


實現一個AIoT架構,一個可能的方式參考下列作法

在Raspberry Pi 這邊, 將一個ML/DL Model 所預測出來的結果, 也許是0或1, 或是分類的softmax機率值等, 依據結果,以事件方式丟到雲端,再由雲端的程式負責進和外界的通訊,通訊的方式可以E-mail, LINE, MQTT, WebSocket等機制。

這樣的好處是資料與通訊管理的細節都在雲端處理, 而Raspberry Pi 只會根據AI預測的結果,於條件滿足的時候再會用到網路。好處: 終端能減少網路的使用, 而且也不必霊端方面的應用邏輯。並且能專司其職,懂AI的人專注在AI身上,懂雲端/Web 技術的人就專注這些Web技術。







#Python  code snippet 

利用python上驗證各種通訊程序, 包含 MQTT, LinePutsh,...


#Node.js code snippet 


// parse application/json
var jsonParser = bodyParser.json()

/MQTT
app.post('/agent/mqtt',jsonParser, function (req, res) {

  //console.log(req.body)
  console.log(req.body.topic);
  console.log(req.body.message);

//測試Linebot是否能通
app.post('/webhook', bot.parser());

//Line Push
app.post('/agent/line', function (req, res) {

  console.log('Line');

  ////Line code/////////////
 // pushLinemsg(req.body.message['0'])
 pushLinemsg(JSON.stringify(req.body.message))


  ////Repsone to http client/////
     respond_http(res);

});





#為使用Linebot 我們使用ngrok 來解決private IP及要提供https服務

./ngrok http 3010




2a87b84c.ngrok.io/webhook 貼到Line的設定中,並verify https 200 OK, 如果可以通代表ngrok 已打通的channel







2018年2月22日 星期四

SIGFOX 連線&傳送教學





Serial (UART) Parameters:9600 baud, no parity, 8 data bit and 1 stop bit
依序輸入指令,建議使用putty連線
AT // will return OK if not, check Arduino UART, board communition or change Terminal app
AT$GI? //will return X,Y, If X=0 or Y<3
AT$RC
AT$SF= xxxxxxxxxxxx //it's what you want to send

This procedure will force the module to send the frame within the macro channel listened by SIGFOX network.





2017年8月17日 星期四

嵌入式系統常用的通訊協定-RS485/Modbus



RS485:
  • 為半雙工(同一時間只能選擇傳送或接收的動作)
  • 為差動傳輸,使用纜線兩端(D+、D-)的電壓差來表示傳遞訊號
  • 常用於單機傳送(Master),多機接收(Slave)的通訊鏈結。可將數個感應裝置的數值回傳給Master
Modbus over RS485:
  • Modbus是一種串列通訊協定
  • Modbus為master/slave架構。一個裝置為Master節點,其他節點為slave。
  • 每一個slave裝置都有一個唯一的位址/ID (1~247)
  • Since a single byte is normally used to define the slave address and each slave on a network requires a unique address, the number of slaves on a network is limited to 256. The limit defined in the modbus specification is even lower at 247.
  • master和slave之間走的Modbus 協定其封包格式有分ASCII 或RTU兩種
  • ASCII 為文字模式, 用character 傳送, RTU 為binary 模式傳送
  • 封包格式:   Slave ID  | Function Code | Data | CRC
RTU 訊息格式
  • Information is stored in the Slave device in four different tables.
  • Two tables store on/off discrete values (coils) and two store numerical values (registers). The coils and registers each have a read-only table and read-write table.
  • Each table has 9999 values.
    Each coil or contact is 1 bit and assigned a data address between 0000 and 270E.
    Each register is 1 word = 16 bits = 2 bytes and also has data address between 0000 and 270E.

Coil/Register Numbers
Data Addresses
TypeTable Name
1-9999
0000 to 270E(9999)
Read-WriteDiscrete Output Coils
10001-19999
0000 to 270E
Read-OnlyDiscrete Input Contacts
30001-39999
0000 to 270ERead-OnlyAnalog Input Registers
40001-49999
0000 to 270ERead-WriteAnalog Output Holding Registers

Coil/Register Numbers can be thought of as location names since they do not appear in the actual messages. The Data Addresses are used in the messages.For example, the first Holding Register, number 40001, has the Data Address 0000. The difference between these two values is the offset.
Each table has a different offset. 1, 10001, 30001 and 40001.

只有Data Address(Offset)才出現在送出的Message 中, 如何知道查的是那一張表呢?
答案是利用Function Code 來決定


What is a function code?

The second byte sent by the Master is the Function code. This number tells the slave which table to access and whether to read from or write to the table.

Function Code (Command) 3 is to read 4xxx registers, and  4 for 3xxx registers. 

Function CodeActionTable Name
01 (01 hex)ReadDiscrete Output Coils
05 (05 hex)Write singleDiscrete Output Coil
15 (0F hex)Write multipleDiscrete Output Coils
02 (02 hex)ReadDiscrete Input Contacts
04 (04 hex)ReadAnalog Input Registers
03 (03 hex)ReadAnalog Output Holding Registers
06 (06 hex)Write singleAnalog Output Holding Register
16 (10 hex)Write multipleAnalog Output Holding Registers

Example: 


Read Holding Registers (FC=03)
Request
This command is requesting the content of analog output holding registers # 40108 to
 40110 from the slave device with address 17.
11 03 006B 0003 7687
11: The Slave Address (11 hex = address17 )
03: The Function Code 3 (read Analog Output Holding Registers)
006B: The Data Address of the first register requested.
             ( 006B hex = 107 , + 40001 offset = input #40108 )
0003: The total number of registers requested. (read 3 registers 40108 to 40110)
7687: The CRC (cyclic redundancy check) for error checking.
Response
11 03 06 AE41 5652 4340 49AD
11: The Slave Address (11 hex = address17 )
03: The Function Code 3 (read Analog Output Holding Registers)
06: The number of data bytes to follow (3 registers x 2 bytes each = 6 bytes)
AE41: The contents of register 40108
5652: The contents of register 40109
4340: The contents of register 40110
49AD: The CRC (cyclic redundancy check).


Read Coil Status (FC=01)

Request
This command is requesting the ON/OFF status of discrete coils # 20 to 56
from the slave device with address 17.
11 01 0013 0025 0E84

11: The Slave Address (11 hex = address17 )
01: The Function Code 1 (read Coil Status)
0013: The Data Address of the first coil to read.
             ( 0013 hex = 19 , + 1 offset = coil #20 )
0025: The total number of coils requested.  (25 hex = 37,  inputs 20 to 56 )
0E84: The CRC (cyclic redundancy check) for error checking.
Response
11 01 05 CD6BB20E1B 45E6
11: The Slave Address (11 hex = address17 )
01: The Function Code 1 (read Coil Status)
05: The number of data bytes to follow (37 Coils / 8 bits per byte = 5 bytes)
CD: Coils 27 - 20 (1100 1101)
6B: Coils 35 - 28 (0110 1011)
B2: Coils 43 - 36 (1011 0010)
0E: Coils 51 - 44 (0000 1110)
1B: 3 space holders & Coils 56 - 52 (0001 1011)
45E6: The CRC (cyclic redundancy check).
The more significant bits contain the higher coil variables. This shows that coil 36 is off (0) and 43 is on (1). Due to the number of coils requested, the last data field1Bcontains the status of only 5 coils.  The three most significant bits in this data field are filled in with zeroes.





RS485 模組 (MAX485)的Pin 腳定義:


  • pin 1 :RO (receive out)
  • pin 2 RE (receive enable) 
  • pin 3 :DE (data enable) 
  • pin 4 :DI (data in)
  • pin 5, pin 8 :  Gnd  and Vcc onnected
  • pin 6,7 : A and B  the RS485 pair

RO------->UART TX
DI<------- UART RX

把/RE and DE 短路, 然後MCU/Pi 用一根GPIO 決定 /RE 或 DE.(即是決定是在送還是在收的狀態, 因為RS485是單工)















讀出來若是以Float 表示, 則需進行轉換成十進制

須考慮 Byte ordering的問題!

http://www.61131.com/download.htm






 AQUAS-SR04











相關文章: