您的位置: 主页>机器人编程>ROBOLAB编程>创客实战 | Arduino+3D打印制作视觉暂留显示器
加盟酷吧机器人 培养孩子核心能力

创客实战 | Arduino+3D打印制作视觉暂留显示器

前言

1

人眼在观察景物时,光信号传入大脑神经,需经过一段短暂的时间,光的作用结束后,视觉形象并不立即消失,这种残留的视觉称“后像”,也被称为是“视觉暂留”。

创客实战 | Arduino+3D打印制作视觉暂留显示器

人眼每秒处理的图像不超过 10-12 个。当一系列图像很快的连续性的滚动时,就会让我们产生幻觉,感觉画面在动。这也是制作动画电影的基本原则。

本期给大家带来一款别出心裁的 LED 显示器,用 Arduino、电机和一排 LED 制作的视觉暂留显示器。

创客实战 | Arduino+3D打印制作视觉暂留显示器

是不是很酷呢,接下来我们先来看一段视频,看看是如何制作的吧。

材料

2

Arduino Nano×1 红外线传感器×1 洞洞板×1 LED 灯×若干 电阻×若干 直流电机×1 电池×1 电线×若干 热熔胶×1 烙铁×1 白纸×1 Arduino IDE(软件)

创客实战 | Arduino+3D打印制作视觉暂留显示器

步骤

3

3D打印

3D 打印部分主要分为旋转支架和固定底座两个部分。

创客实战 | Arduino+3D打印制作视觉暂留显示器

所需 3D 打印的 STL 文件请点击阅读原文下载。

安装 LED

3D 部件打印完毕后,就可以进入操作环节了。 1、剪取一块洞洞板,大小与旋转支架部分相匹配。

创客实战 | Arduino+3D打印制作视觉暂留显示器

2、安装 LED 灯,我使用八个红色的 LED 灯。关于灯的颜色,你可以自由选择。

创客实战 | Arduino+3D打印制作视觉暂留显示器

3、将所有 LED 灯的负极端口都焊接到洞洞板上。

创客实战 | Arduino+3D打印制作视觉暂留显示器

4、添加电阻,防止 LED 灯因电压(5V)过高而烧坏。我使用 220ohm 的电阻,将每个电阻焊接到每个 LED 灯的正极。

5、将跳线电缆连接到电阻的另一个脚上。

连接 LED 与 Arduino Nano

创客实战 | Arduino+3D打印制作视觉暂留显示器

连接接口的方式如下: LED0:Nano 的 D2 。 LED1:Nano 的 D3 。 LED2:Nano 的 D4 。 LED3:Nano 的 D5 。 LED4:Nano 的 D6 。 LED5:Nano 的 D7 。 LED6:Nano 的 D8 。 LED7:Nano 的 D9 。 负极为:Nano 的 Ground 。

安装直流电机

将直流电机安装到固定底座上并通电。

创客实战 | Arduino+3D打印制作视觉暂留显示器

添加红外线传感器

我们需要一个点作为文本读写开始的起点。在固定底座下面粘贴一块白纸块作为起点,红外线传感器能检测到这张白纸块。 如果改变白纸的位置,那么文本显示的位置也将随之发生改变。

创客实战 | Arduino+3D打印制作视觉暂留显示器创客实战 | Arduino+3D打印制作视觉暂留显示器创客实战 | Arduino+3D打印制作视觉暂留显示器

红外线传感器与 Nano 连接方式如下 : GND:Nano 的 GND。 Vin:Nano 的 5V。 Out:Nano 的 D10。

组装部件

1、连接电源,给 Arduino Nano 通电。

创客实战 | Arduino+3D打印制作视觉暂留显示器

2、将 Arduino Nano 安装到旋转的部件中。

创客实战 | Arduino+3D打印制作视觉暂留显示器

3、将旋转部件安装到固定底座上。

创客实战 | Arduino+3D打印制作视觉暂留显示器intNUMBER9[]={1,1,1,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1, 1,1,1,1,1,1,1,1};int NUMBER8[]={0,1,1,0,1,1,1,0,1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1,0,1,1,0,1,1,1,0};int NUMBER7[]={1,0,0,0,0,0,0,0, 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0, 1,0,0,1,1,1,1,1, 1,1,1,0,1,0,0,0};intNUMBER6[]={1,1,1,1,1,1,1,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,1, 1,0,0,0,1,1,1,1};int NUMBER5[]={1,1,1,1,1,0,0,1,1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1,1,0,0,0,1,1,1,1};int NUMBER2[]= {1,0,0,0,0,0,1,1, 1,0,0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0,0,0,0,0,0, 1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0};int U[] = {1,1,1,1,1,1,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, 1,1,1,1,1,1,1,0};int V[] ={1,1,1,1,1,1,0,0, 0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 1,1,1,1,1,1,0,0};int W[] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0, 0,0,0,0,0,1,0,0, 0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1};int X[] = {1,1,0,0,0,0,1,1, 0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0, 0,0,1,0,0,1,0,0, 1,1,0,0,0,0,1,1};int Y[] ={1,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0, 0,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0, 1,1,0,0,0,0,0,0};int Z[] = {1,0,0,0,0,1,1,1,1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,1, 1,0,1,0,0,0,0,1,1,1,0,0,0,0,0,1};int* alpha[]= {A,B,C,D,E,F,G,H,I,J,K,L,M,N};intletterSpace;int delayTime;#define IR_pin 10voidsetup(){Serial.begin(9600);pinMode(IR_pin,INPUT);for( int i = 2;i<10 ;i++ ) {pinMode(i,OUTPUT);}    letterSpace =4;        delayTime=1;}void printLetter(int letter[]) {int y;for(y=0; y < 8; y++) {digitalWrite(y+2,letter[y]);}delay(delayTime);for(y=0; y < 8; y++){digitalWrite(y+2, letter[y+8]);}delay(delayTime);for(y=0; y < 8; y++) {digitalWrite(y+2,letter[y+16]);}delay(delayTime);for(y = 0; y < 8; y++){digitalWrite(y+2, letter[y+24]);}delay(delayTime);for(y = 0; y< 8; y++) {digitalWrite(y+2,letter[y+32]);}delay(delayTime);for (y=0; < 8; y++) {digitalWrite(y+2,0);}delay(letterSpace);}void loop() {if(digitalRead(IR_pin)==LOW){printLetter (P);printLetter (O);printLetter (V);printLetter(_);printLetter (_);printLetter (D);printLetter (I);printLetter(S);printLetter (P);printLetter (L);printLetter (A);printLetter(Y);printLetter (_);}}

代码文件可点击阅读原文下载。

当红外线传感器检测到白纸时,LED 灯就开始发光并显示出视觉暂留的效果。由于视觉暂留原理,开关特定 LED 灯时,会显现出不同的图像相互重叠而形成的文字。

后记,小编朋友研发了一个游戏化的少儿编程在线课程(5-12岁),游戏化教学结合scratch(一款在线少儿编程工具,类似乐高的积木拼搭),我家娃娃学了几次课,非常喜欢(超预期),16次课才200多块钱,对锻炼孩子的思维能力和动手动力很有帮助。

欧美思机器人教育加盟 赚钱好项目
上一篇:机器人编程——闪躲高手
下一篇:39用scratch3.0实现数字石头桥
您可能喜欢
回到顶部