{"id":34420,"date":"2023-04-21T22:55:47","date_gmt":"2023-04-22T03:55:47","guid":{"rendered":"https:\/\/www.bjultrasonic.com\/how-to-make-a-sonar-device-at-home\/"},"modified":"2025-01-20T23:23:15","modified_gmt":"2025-01-21T04:23:15","slug":"how-to-make-a-sonar-device-at-home","status":"publish","type":"post","link":"https:\/\/www.bjultrasonic.com\/zh-hans\/how-to-make-a-sonar-device-at-home\/","title":{"rendered":"\u81ea\u5236\u58f0\u5450\u88c5\u7f6e\uff1a\u539f\u7406\u8be6\u89e3\u4e0e\u5bb6\u5ead\u5236\u4f5c\u8be6\u7ec6\u6b65\u9aa4\u6307\u5357"},"content":{"rendered":"<p>\u81ea\u5236\u58f0\u5450\u88c5\u7f6e\uff1a\u4e00\u4e2a\u5bb6\u5ead\u5b9e\u9a8c\u6307\u5357<\/p>\n<p>\u58f0\u5450\u6280\u672f\u770b\u4f3c\u590d\u6742\uff0c\u4f46\u5176\u57fa\u672c\u539f\u7406\u5374\u53ef\u4ee5\u5229\u7528\u7b80\u5355\u7684\u6750\u6599\u5728\u5bb6\u4e2d\u8fdb\u884c\u6a21\u62df\u5b9e\u9a8c\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5229\u7528\u5e38\u89c1\u7684\u7535\u5b50\u5143\u4ef6\u548c\u7f16\u7a0b\u77e5\u8bc6\uff0c\u5236\u4f5c\u4e00\u4e2a\u7b80\u6613\u7684\u58f0\u5450\u88c5\u7f6e\uff0c\u5e76\u6df1\u5165\u63a2\u8ba8\u5176\u5de5\u4f5c\u539f\u7406\u548c\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u3002  \u8fd9\u5e76\u975e\u4e00\u4e2a\u9ad8\u7cbe\u5ea6\u4e13\u4e1a\u8bbe\u5907\uff0c\u800c\u662f\u65e8\u5728\u5e2e\u52a9\u7406\u89e3\u58f0\u5450\u6280\u672f\u7684\u57fa\u672c\u6982\u5ff5\u548c\u5b9e\u8df5\u8fc7\u7a0b\u3002<\/p>\n<h3>\u4e00\u3001\u6240\u9700\u6750\u6599\u53ca\u5de5\u5177<\/h3>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th>\u6750\u6599\/\u5de5\u5177<\/th>\n<th>\u8bf4\u660e<\/th>\n<th>\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u8d85\u58f0\u6ce2\u4f20\u611f\u5668<\/td>\n<td>\u80fd\u591f\u53d1\u5c04\u548c\u63a5\u6536\u8d85\u58f0\u6ce2\u4fe1\u53f7\u3002\u9891\u7387\u5efa\u8bae\u572840kHz\u5de6\u53f3\u3002<\/td>\n<td>\u53ef\u5728\u7535\u5b50\u5143\u4ef6\u5546\u5e97\u8d2d\u4e70\uff0c\u4f8b\u5982\u67d0\u4e9b\u578b\u53f7\u7684HC-SR04\u4f20\u611f\u5668<\/td>\n<\/tr>\n<tr>\n<td>Arduino\u5f00\u53d1\u677f<\/td>\n<td>\u7528\u4e8e\u63a7\u5236\u4f20\u611f\u5668\u548c\u5904\u7406\u6570\u636e\u3002<\/td>\n<td>Arduino Uno\u6216\u7c7b\u4f3c\u578b\u53f7\u5747\u53ef<\/td>\n<\/tr>\n<tr>\n<td>\u9762\u5305\u677f<\/td>\n<td>\u7528\u4e8e\u8fde\u63a5\u7535\u8def\u5143\u4ef6\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u8df3\u7ebf<\/td>\n<td>\u7528\u4e8e\u8fde\u63a5\u7535\u8def\u5143\u4ef6\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u7535\u6e90\u9002\u914d\u5668<\/td>\n<td>\u4e3aArduino\u5f00\u53d1\u677f\u4f9b\u7535\u3002<\/td>\n<td>5V\u76f4\u6d41\u7535\u6e90<\/td>\n<\/tr>\n<tr>\n<td>\u7535\u963b\u5668\uff08\u53ef\u9009\uff09<\/td>\n<td>\u6839\u636e\u4f20\u611f\u5668\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u7535\u963b\u503c\uff0c\u7528\u4e8e\u4fdd\u62a4\u7535\u8def\u3002<\/td>\n<td>\u5177\u4f53\u7535\u963b\u503c\u53d6\u51b3\u4e8e\u6240\u9009\u7528\u7684\u4f20\u611f\u5668<\/td>\n<\/tr>\n<tr>\n<td>\u7535\u8111\u53caUSB\u6570\u636e\u7ebf<\/td>\n<td>\u7528\u4e8e\u4e0a\u4f20\u7a0b\u5e8f\u5230Arduino\u5f00\u53d1\u677f\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u8f6f\u4ef6\uff08Arduino IDE\uff09<\/td>\n<td>\u7528\u4e8e\u7f16\u5199\u548c\u4e0a\u4f20\u7a0b\u5e8f\u5230Arduino\u5f00\u53d1\u677f\u3002<\/td>\n<td>\u514d\u8d39\u4e0b\u8f7d<\/td>\n<\/tr>\n<tr>\n<td>\u7269\u4f53\uff08\u7528\u4e8e\u6d4b\u8bd5\uff09<\/td>\n<td>\u4e0d\u540c\u6750\u8d28\u3001\u5f62\u72b6\u548c\u5927\u5c0f\u7684\u7269\u4f53\uff0c\u7528\u4e8e\u6d4b\u8bd5\u58f0\u5450\u7684\u63a2\u6d4b\u80fd\u529b\u3002<\/td>\n<td>\u4f8b\u5982\uff1a\u6728\u5757\u3001\u91d1\u5c5e\u5757\u3001\u6ce1\u6cab\u5851\u6599\u7b49<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e8c\u3001\u7535\u8def\u8fde\u63a5<\/h3>\n<p>\u5c06\u8d85\u58f0\u6ce2\u4f20\u611f\u5668\u548cArduino\u5f00\u53d1\u677f\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8fde\u63a5\uff1a<\/p>\n<ul>\n<li><strong>\u4f20\u611f\u5668VCC\u8fde\u63a5\u5230Arduino\u76845V\u7535\u6e90\u3002<\/strong><\/li>\n<li><strong>\u4f20\u611f\u5668GND\u8fde\u63a5\u5230Arduino\u7684GND\u3002<\/strong><\/li>\n<li><strong>\u4f20\u611f\u5668TRIG\u8fde\u63a5\u5230Arduino\u7684\u4e00\u4e2a\u6570\u5b57\u5f15\u811a\uff08\u4f8b\u5982\uff1a7\u53f7\u5f15\u811a\uff09\u3002<\/strong><\/li>\n<li><strong>\u4f20\u611f\u5668ECHO\u8fde\u63a5\u5230Arduino\u7684\u53e6\u4e00\u4e2a\u6570\u5b57\u5f15\u811a\uff08\u4f8b\u5982\uff1a8\u53f7\u5f15\u811a\uff09\u3002<\/strong><\/li>\n<\/ul>\n<p>\u5efa\u8bae\u4f7f\u7528\u9762\u5305\u677f\u8fdb\u884c\u8fde\u63a5\uff0c\u8fd9\u6837\u65b9\u4fbf\u8c03\u8bd5\u548c\u4fee\u6539\u7535\u8def\u3002  \u8fde\u63a5\u5b8c\u6210\u540e\uff0c\u786e\u4fdd\u6240\u6709\u8fde\u63a5\u7262\u56fa\uff0c\u907f\u514d\u865a\u710a\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n<h3>\u4e09\u3001Arduino\u7a0b\u5e8f\u7f16\u5199<\/h3>\n<p>\u6211\u4eec\u9700\u8981\u7f16\u5199\u4e00\u4e2aArduino\u7a0b\u5e8f\u6765\u63a7\u5236\u8d85\u58f0\u6ce2\u4f20\u611f\u5668\uff0c\u6d4b\u91cf\u56de\u58f0\u65f6\u95f4\uff0c\u5e76\u8ba1\u7b97\u51fa\u8ddd\u79bb\u3002  \u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u7a0b\u5e8f\uff1a<\/p>\n<pre><code class=\"language-c++\">const int trigPin = 7;\nconst int echoPin = 8;\n\nvoid setup() {\n  pinMode(trigPin, OUTPUT);\n  pinMode(echoPin, INPUT);\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  long duration, distance;\n  digitalWrite(trigPin, LOW);\n  delayMicroseconds(2);\n  digitalWrite(trigPin, HIGH);\n  delayMicroseconds(10);\n  digitalWrite(trigPin, LOW);\n  duration = pulseIn(echoPin, HIGH);\n  distance = duration * 0.034 \/ 2;\n  Serial.print(\"Distance: \");\n  Serial.println(distance);\n  delay(100);\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u7a0b\u5e8f\u4f1a\u5c06\u6d4b\u91cf\u7684\u8ddd\u79bb\u6253\u5370\u5230\u4e32\u53e3\u76d1\u89c6\u5668\u4e2d\u3002  \u4f60\u53ef\u80fd\u9700\u8981\u6839\u636e\u4f60\u7684\u4f20\u611f\u5668\u548c\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\u7a0b\u5e8f\u53c2\u6570\u3002<\/p>\n<h3>\u56db\u3001\u7a0b\u5e8f\u4e0a\u4f20\u53ca\u6d4b\u8bd5<\/h3>\n<p>\u5c06\u7f16\u5199\u597d\u7684\u7a0b\u5e8f\u4e0a\u4f20\u5230Arduino\u5f00\u53d1\u677f\u3002\u4e0a\u4f20\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u4e32\u53e3\u76d1\u89c6\u5668\uff0c\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u6d4b\u91cf\u7684\u8ddd\u79bb\u6570\u636e\u4e86\u3002  \u4f7f\u7528\u4e0d\u540c\u7684\u7269\u4f53\u8fdb\u884c\u6d4b\u8bd5\uff0c\u89c2\u5bdf\u8ddd\u79bb\u6d4b\u91cf\u7ed3\u679c\u7684\u53d8\u5316\uff0c\u5e76\u5206\u6790\u5176\u5f71\u54cd\u56e0\u7d20\uff0c\u4f8b\u5982\u7269\u4f53\u7684\u6750\u8d28\u3001\u5f62\u72b6\u548c\u5927\u5c0f\uff0c\u4ee5\u53ca\u73af\u5883\u566a\u97f3\u7b49\u3002<\/p>\n<h3>\u4e94\u3001\u7ed3\u679c\u5206\u6790\u4e0e\u6539\u8fdb<\/h3>\n<p>\u901a\u8fc7\u6d4b\u8bd5\uff0c\u4f60\u53ef\u4ee5\u89c2\u5bdf\u5230\u4e0d\u540c\u7269\u4f53\u5bf9\u58f0\u5450\u6d4b\u8ddd\u7ed3\u679c\u7684\u5f71\u54cd\u3002  \u8fd9\u5176\u4e2d\u6d89\u53ca\u5230\u58f0\u6ce2\u7684\u53cd\u5c04\u3001\u5438\u6536\u548c\u6563\u5c04\u7b49\u7269\u7406\u73b0\u8c61\u3002  \u4f60\u53ef\u4ee5\u5c1d\u8bd5\u6539\u8fdb\u7a0b\u5e8f\uff0c\u4f8b\u5982\u6dfb\u52a0\u6ee4\u6ce2\u7b97\u6cd5\u6765\u51cf\u5c11\u566a\u58f0\u7684\u5f71\u54cd\uff0c\u6216\u8005\u4f7f\u7528\u66f4\u590d\u6742\u7684\u7b97\u6cd5\u6765\u63d0\u9ad8\u6d4b\u8ddd\u7cbe\u5ea6\u3002  \u5b9e\u9a8c\u8fc7\u7a0b\u4e2d\uff0c\u8bb0\u5f55\u6bcf\u6b21\u6d4b\u91cf\u7684\u7ed3\u679c\uff0c\u5e76\u8fdb\u884c\u6570\u636e\u5206\u6790\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u58f0\u5450\u7684\u5de5\u4f5c\u539f\u7406\u3002<\/p>\n<p>\u6700\u7ec8\uff0c\u901a\u8fc7\u8fd9\u4e2a\u7b80\u5355\u7684\u5bb6\u5ead\u5b9e\u9a8c\uff0c\u4f60\u53ef\u4ee5\u4eb2\u8eab\u4f53\u9a8c\u58f0\u5450\u6280\u672f\u7684\u9b45\u529b\uff0c\u5e76\u52a0\u6df1\u5bf9\u58f0\u6ce2\u548c\u7535\u5b50\u6280\u672f\u7684\u7406\u89e3\u3002  \u8bb0\u4f4f\uff0c\u8fd9\u662f\u4e00\u4e2a\u7b80\u6613\u7684\u58f0\u5450\u88c5\u7f6e\uff0c\u5176\u7cbe\u5ea6\u548c\u7a33\u5b9a\u6027\u53ef\u80fd\u4e0d\u5982\u4e13\u4e1a\u7684\u8bbe\u5907\uff0c\u4f46\u5b83\u8db3\u4ee5\u8ba9\u4f60\u5165\u95e8\u58f0\u5450\u6280\u672f\u7684\u5947\u5999\u4e16\u754c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u81ea\u5236\u58f0\u5450\u88c5\u7f6e\uff1a\u4e00\u4e2a\u5bb6\u5ead\u5b9e\u9a8c\u6307\u5357 \u58f0\u5450\u6280\u672f\u770b\u4f3c\u590d\u6742\uff0c\u4f46\u5176\u57fa\u672c\u539f\u7406\u5374\u53ef\u4ee5\u5229\u7528\u7b80\u5355\u7684\u6750\u6599\u5728\u5bb6\u4e2d\u8fdb\u884c\u6a21\u62df\u5b9e\u9a8c\u3002\u672c\u6587\u5c06\u8be6<\/p>\n","protected":false},"author":1,"featured_media":26939,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6413],"tags":[],"class_list":["post-34420","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","prodpage-classic"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/posts\/34420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=34420"}],"version-history":[{"count":0,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/posts\/34420\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/media\/26939"}],"wp:attachment":[{"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=34420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=34420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bjultrasonic.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=34420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}