硬件设置

简介:硬件设置

About: Making and sharing are my two biggest passions! In total I've published hundreds of tutorials about everything from microcontrollers to knitting. I'm a New York City motorcyclist and unrepentant dog mom. My wo…

In this lesson, we'll take a closer look at the ESP8266 hardware and the techniques you'll need for creating your own circuits in the rest of the lessons. If you bought a pre-assembled board, you don't absolutely need to know how to solder to complete this class, but a lot opens up to you if you do! Check out theSoldering lessonfrom Randy's Electronics Class to learn how or brush up on your skills.

步骤1:焊头

You have a few options when it comes to connecting to your Feather Huzzah board. The connectors we'll attach are calledheader pins(or just "headers" for short), and they are available in several flavors.

You can purchase the Feather Huzzah and other ESP8266 boards preassembled with male or stacking headers, but if you want terminal blocks or some other way to connect, you'll have to solder them up yourself.

对于普通的公头针上的焊料,首先使用电路板测量并切割条带的长度,如有必要。

将销的短端插入电路板的下侧,并将它们夹在无焊接面包板中以对准引脚并在焊接时将其夹在适当位置。在每个条带上焊接一个销以稳定任何摆动,然后返回并焊接其余销的位置。这款相同的标题焊接程序很方便了许多其他电路板和配件 - 将其添加到您的工具箱!

对于堆叠或母标,请使用一块胶带将标题固定到电路板的顶部。在每个条带上钉一个销钉。如果它是弯曲的,可以在焊接剩余销钉之前重新调整标题带的同时重新加热这一引脚。

对于您需要路由到机箱的电线,或者要频繁地断开连接,终端块标题是一个有用的选择。如果您希望电路超级平面,您可以选择将电线直接连接到电路板并完全跳过标题。

I usually keep a Feather Huzzah board with stacking headers around, just for prototyping. When I want to build a finalized circuit, I might choose lower profile components, but the convenience of easily plugging and unplugging components works fabulously for the prototyping stage of any project.

Step 2: Pinout Diagram

这些图表s shows the various functions of the Feather Huzzah ESP8266 board and NodeMCU, respectively.NC.stands for "not connected". This information is consolidated from the (much more detailed)product documentation for the Feather Huzzah ESP8266。以下是PINS函数和注意事项的摘要:

RST- 3.3V reset pin, connect to ground momentarily to reset ESP8266

3.3 vPIN(500mA峰值电流,建议在250mA下维护WiFi性能)

GND- common ground for logic and power

ADC- analog input (1V max, use a voltage divider if working with a higher voltage signal)

销14 / SCK- 3.3V digital GPIO, SPI default SCK pin

PIN 13 / MO- 3.3V digital GPIO, SPI default MOSI pin

Pin 12/MI- 3.3V digital GPIO, SPI default MISO pin

(SPI is a protocol for controlling devices thoughbitbanging, such asLED背包)

RX- receive input to the ESP8266 module (5V compliant, has level shifter)

TX- 从ESP8266模块(3.3V)传输输出,避免使用串行通信处于活动状态

CHPD- 3.3V enable pin for ESP8266, connect to ground momentarily to reset ESP8266

蝙蝠pin - positive voltage from lipoly battery jack (if connected)

EN针 - 连接到地,关闭3.3V稳压器(除了Lipoly Charer外的一切)

USBUSB端口的销正电压(如果连接)

Pin 14- 与上面的SCK一样

Pin 12- same as MI above

Pin 13- same as MO above

Pin 15- 3.3V通用输入/输出(数字GPIO),有拉下来的电阻内置,在启动时不应该高避免BootMode

Pin 0- 3.3V数字GPIO带内置红色LED(设置为低电面打开),无内部上拉电阻,启动时不应较低,以避免BootMode

Pin 16- 3.3V digital GPIO, connect to RST to use this pin to wake from sleep mode

Pin 2- 3.3V digital GPIO with built-in blue LED (which is also connected to the wifi antenna), internal pullup resistor connected, should not be low at startup to avoid bootmode

PIN 5 / SCL- 3.3V数字GPIO,I2C默认SCL引脚

Pin 4/ SDA- 3.3V digital GPIO, I2C default SDA pin

(I2C or "eye squared see" or "eye two see" is a protocol for controlling devices thoughbitbanging, such asLED背包)

第3步:建筑电路

Let's put together a basic circuit that will be useful and relevant to the rest of the lessons. If the solderless breadboard is still a mystery to you, have no fear! First review theintroductory lesson in the Arduino classto learn how breadboards work.

作为快速进修,请记住,面包板有长的公共汽车,沿着每个边缘运行,中心的较短连接器,由中间的条形分开。

将羽毛Huzzah插入无焊接面包板,跨越中间栏。用小按钮做同样的事情。记得在接线变化时始终断开电源/ USB。

Next, grab an LED and connect its positive (longer) lead to a hole in the breadboard next to pin marked 13 on your board (D7 on NodeMCU). Plug the negative (shorter) lead of the LED into the breadboard's ground bus (any hole along the labeled blue line). The button and LED make up the most basic input and output for your first experiments. Since the Feather Huzzah is a 3V device (Arduino Uno is 5V), I chose not to use a resistor with my LED.

Let's add some wires to connect up our LED and pushbutton. First it's important to establish a common ground, so pick up a wire (any color will do but for convention I'm using black) and plug it into any hole along the ground bus and the hole next to the pin marked GND on your Feather Huzzah board.

将另一根电线从地面总线连接到按钮的一条腿。

最后,将来自按钮的另一条腿连接到电路板上的引脚4(D2上的Nodemcu)。我们将激活此PIN的内部pull-up resistorin the code in order to read the button.

仔细检查电路,然后将USB电缆插入计算机。

Load up this sample code (copy from below or下载此步骤的附件and open in Arduino); it's just a basic button-illuminates-LED circuit that will test your wiring and further cement your understanding of the software/hardware workflow.

#define LED_PIN 13 #define Button_pin 4 //按钮状态int current = 0;int last = 0;void setup(){Pinmode(LED_PIN,输出);Pinmode(Button_pin,input_pullup);void循环(){//抓住按钮的当前状态。//我们必须翻转逻辑,因为我们使用input_pullup。if(DigitalRead(Button_pin)==低)电流= 1;否则电流= 0;//如果如果(当前==上次)返回,则返回值;DigitalWrite(LED_PIN,电流); last = current; }

测试一旦将代码上载到您的电路板,按下按钮亮起LED。如果没有,请检查此常见错误列表:

  • 电线连接丢失/不正确(在制作更改之前拔下堵塞)
  • LED向后连接
  • Code not uploaded successfully
    • 板类型不正确
    • Port not selected/incorrect
    • 板必须在启动模式(自动羽毛Huzzah和节点MCU,通常通过其他板上的按钮按压组合)

现在,您都设置了解决您的第一个项目原型!在下面的类项目模块中发布庆祝光电路的庆祝照片。在您获得一个工作的按钮电路之前,请勿继续,因为它是添加互联网连接和课程稍后更复杂的功能的基础。如果你被困,请俯视下面的问一个问题部分!

110 People Made This Project!

Recommendations

  • 让它发光比赛

    让它发光比赛
  • First Time Author Contest

    First Time Author Contest
  • PCB挑战

    PCB挑战

Discussions