annotate setup.rst @ 33:61d01865fc86 default tip

Update setup instructions.
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 25 Jun 2016 12:47:39 +0200
parents 379eeec3777a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
1 Setup
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
2 *****
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
3
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
4 Prerequisites
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
5 =============
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
7 To participate in the workshop, you will need the following:
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
8
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
9 * A laptop with Linux, Mac OS or Windows and at least one free USB port.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
10 * If it's Windows or Mac OS, make sure to install `drivers`_ for the CP2102 UBS2TTL chip. MacOS El Capitan requires `disabling kext signing`_ to install it.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
11 * A micro-USB cable with data lines that fits your USB port.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
12 * You will need a terminal application installed. For Linux and Mac you can
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
13 use ``screen``, which is installed by default. For Windows we recommend `PuTTy`_ or `CoolTerm`_.
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
14 * Please note that the workshop will be in English.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
15
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
16 .. _drivers: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
17 .. _disabling kext signing: http://farazmemon.com/2016/02/07/flashing-latest-firmware-on-nodemcu-devkit-v0-9-osx-el-capitan/
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
18 .. _PuTTy: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
19 .. _CoolTerm: http://freeware.the-meiers.org/
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
20
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
21 In addition, at the workshop, you will receive:
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
22 * "NodeMCU AMICA" development board with ESP8266 on it,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
23 * Red LED,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
24 * 100Ω resistor,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
25 * SG90 microservo,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
26 * Female-female and Male-female dupont cables,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
27 * Piezoelectric speaker.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
28
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
29 You will take all that home with you.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
30
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
31 The firmware that is flashed on the boards is also available at https://bitbucket.org/thesheep/espworkshop/downloads/firmware-combined.bin
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
32
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
33 There will be also some additional hardware available for experimenting,
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
34 which you won't take home.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
35
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
36
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
37 Development Board
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
38 =================
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
39
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
40 The board we are using is called "NodeMCU AMICA" and has an ESP8266 module
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
41 on it, which we will be programming. It comes with the latest version of
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
42 Micropython already setup on it, together with all the drivers we are going
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
43 to use.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
44
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
45 .. note::
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
46 The D0, D1, D2, ... numbers printed on the board are different from what
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
47 Micropython uses -- because originally those boards were made for a
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
48 different software. Make sure to refer to the image below to determine
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
49 which pins are which.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
50
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
51 .. image:: ./images/board.png
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
52 :width: 512px
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
53
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
54
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
55 On top it has a micro-USB socket, for connecting to the computer. Next to it
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
56 are two buttons, one for reset and one for flashing. Then on both sides of the
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
57 board are two rows of pins, to which we will be connecting cables.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
58
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
59 The symbols meaning is as follows:
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
60
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
61 * ``3v3`` - this is a fancy way to write 3.3V, which is the voltage that the
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
62 board runs on internally. You can think about this pin like the plus side
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
63 of a battery. There are several pins like this, they are all connected
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
64 inside.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
65 * ``gnd`` - this is the ground. Think about it like the minus side of the
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
66 battery. They are also all connected.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
67 * ``gpioXX`` - "gpio" stands for "general purpose input output". Those are
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
68 the pins we will be using for sending and receiving signals to and from
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
69 various devices that we will connect to them. They can act as output --
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
70 pretty much like a switch that you can connect to plus or to minus with
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
71 your program. Or they can act as input, telling your program whether they
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
72 are connected to plus or minus.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
73 * ``a0`` - this is the analog pin. It can measure the voltage that is applied
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
74 to it, but it can only handle up to 1V.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
75 * ``vin`` - this pin is connected with the 5V from your computer. You can
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
76 also use it to power your board with a battery when it's not connected to
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
77 the computer. The voltage applied here will be internally converted to the
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
78 3.3V that the board needs.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
79 * ``rst`` - this is a reset button (and a corresponding pin, to which you can
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
80 connect external button).
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
81 * ``flash`` - hold down this button while resetting to bring the board into
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
82 programming mode (also known as flashing mode).
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
83
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
84 The other pins are used internally by the board, and we will not be connecting
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
85 anything to them.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
86
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
87
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
88 Connecting
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
89 ==========
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
90
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
91 The board you got should already have Micropython with all the needed libraries
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
92 flashed on it. In order to access its console, you will need to connect it to
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
93 your computer with the micro-USB cable, and access the serial interface that
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
94 appears with a terminal program.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
95
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
96
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
97 Linux and MacOS
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
98 ---------------
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
99
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
100 Simply open a terminal and run the following commands. On Linux::
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
101
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
102 screen /dev/ttyUSB0 115200
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
103
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
104 On MacOS::
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
105
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
106 screen /dev/tty.SLAB_USBtoUART 115200
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
107
7
53ba8183ea30 Add beeper example
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 6
diff changeset
108 To exit screen, press ctrl+A and then capital K.
53ba8183ea30 Add beeper example
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 6
diff changeset
109
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
110
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
111 Windows
22
379eeec3777a Remove accidentally pasted code
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 21
diff changeset
112 -------
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
113
33
61d01865fc86 Update setup instructions.
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 22
diff changeset
114 For the serial interface to appear in your system, you will need to install the drivers_ for CP2102. Once you have that, you can use either Hyper Terminal, PuTTy or CoolTerm to connect to it, following this guide_.
6
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
115
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
116 The parameters for the connection are: 115200 baud rate, 8 data bits, no parity, 1 stop bit, no flow control.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
117
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
118
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
119 Hello world!
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
120 ------------
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
121
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
122 Once you are connected, press "enter" and you should see the Micropython prompt, that looks like this::
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
123
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
124 >>>
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
125
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
126 It's traditional to start with a "Hello world!" program, so type this and press "enter"::
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
127
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
128 print("Hello world!")
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
129
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
130 If you see "Hello world!" displayed in the next line, then congratulations, you got it working.
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
131
b263b8040dc0 Reorganize
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
132 .. _guide: https://techawarey.wordpress.com/tag/serial-port-communication-in-windows-7-using-hyper-terminal-and-putty/
21
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
133
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
134
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
135 Official Documentation and Support
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
136 ==================================
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
137
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
138 The official documentation for this port of Micropython is available at
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
139 http://micropython.org/resources/docs/en/latest/esp8266/. There is a also a
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
140 forum on which you can ask questions and get help, located at
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
141 http://forum.micropython.org/. Finally, there are ``#esp8266`` and
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
142 ``#micropython`` channels on http://freenode.net IRC network, where people chat
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
143 in real time. Remember that all people there are just users like you, but
ee3b3aa250c8 Add links to official documentation and support
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents: 7
diff changeset
144 possibly more experienced, and not employees who get paid to help you.