Difference: HardwareAccessAndMicropython (1 vs. 7)

Revision 72019-06-11 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"

Start Presentation

Slide 1: Setting up and IoT

Line: 42 to 42
 

How to program the processor

Changed:
<
<
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see:
https://docs.espressif.com/projects/esp-idf/en/latest

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:

https://docs.espressif.com/projects/esp-idf/en/latest

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc

>
>
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see:
https://docs.espressif.com/projects/esp-idf/en/latest

  • The Arduino IDE
    Needs extensions for these processors
    and the different CPU boards

see:

https://docs.espressif.com/projects/esp-idf/en/latest

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc

 

Flashing the code

Line: 53 to 53
 

esptool

  • esptool is called from the Makefiles in ESP-IDF
  • esptool is used when we upload code from the Arduino IDE to the processor flash
Changed:
<
<
  • esptool is used when the Micropython IDE uPyCraft

    installs Micropython onto the processor flash
>
>
  • esptool is used with Micropython IDE on uPyCraft

    installs Micropython onto the processor flash
 In the above cases the use of esptool is hidden to us.

We can however also execute esptool directly.

Line: 149 to 149
  It is written in PyQt4 the Python language binding to Qt4.
Changed:
<
<
The Linux version did not work for me
>
>
The Linux version did not work for me when running Ubuntu 18.04 or later.
  I found a version based on PyQt5 (new version of QT) which was even worse.
Line: 251 to 251
 
  • each ws18b12 contains the 3 colored LEDs and a controller.

  • Can be cascaded and individually addressed, depending on its position in the chain

  • Needs precise timing

Changed:
<
<
  • To use it we pass through the neopixel library built into MicroPython
>
>
  • To use it we pass through the neopixel library built into micropython
 

Changed:
<
<

WS2812B timing

>
>

WS2812B timing

  For all the details on the ws2812b look at

https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf
Line: 268 to 268
 ws2812ControlWord.png

Changed:
<
<

Cascading the WS2812B

>
>

Cascading the WS2812B

 

Line: 371 to 371
 

The SHT30 digital temperature and relative humidity sensor

Changed:
<
<
The SHT30 is a digital temperature and humidity sensor based on the I2C bus
>
>
The SHT30 is a digital temperature and humidity sensor based on the I2C bus
  Here is its data sheet.

Temperature precision: +- 0.3 °C

Relative humidity: +- 3 %

Works on 2.4V – 5.5 V

sht30Block.png
Line: 398 to 398
 While for the course we only use the CPU and 2 sensor shields:

  • ESP8266 CPU (a more powerful ESP32 CPU exists)
  • SHT30 temperature and humidity sensor
Changed:
<
<
>
>
  • Ws2812B rgb LED (neopixel)
  there are many more available on the market.

We have a dozen such shields here for demo.

All demo programs can be found at:

https://github.com/uraich/MicroPython_IoTDemos

Revision 62019-06-09 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"

Start Presentation

Slide 1: Setting up and IoT

Line: 391 to 391
 sht30Results.png

Added:
>
>

Where to find the demo code

While for the course we only use the CPU and 2 sensor shields:

  • ESP8266 CPU (a more powerful ESP32 CPU exists)
  • SHT30 temperature and humidity sensor
  • WS2812B rgb LED (neopixel) there are many more available on the market.

    We have a dozen such shields here for demo.

    All demo programs can be found at:

    https://github.com/uraich/MicroPython_IoTDemos

 

WeMos D1 mini sensor and actuator shields (1)

wemosButton.png wemosWS2812.png wemosOLED.png
Line: 405 to 416
 
Passive Buzzer Data Logger SHT30 temperature and humidity sensor
tripleBase.png proto.png
triple base my prototype board: LED + photo resistor
Added:
>
>

Cost

 
Added:
>
>
cost.png
 

Pinouts of shields

Line: 553 to 567
 
META FILEATTACHMENT attachment="ds18b20Code.png" attr="" comment="" date="1557848024" name="ds18b20Code.png" path="ds18b20Code.png" size="66399" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pushbuttonCode.png" attr="" comment="" date="1557848026" name="pushbuttonCode.png" path="pushbuttonCode.png" size="67126" user="UliRaich" version="1"
META FILEATTACHMENT attachment="dht11Code.png" attr="" comment="" date="1557852263" name="dht11Code.png" path="dht11Code.png" size="55780" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="cost.png" attr="" comment="" date="1560092541" name="cost.png" path="cost.png" size="44637" user="UliRaich" version="1"

Revision 52019-05-14 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"

Start Presentation

Slide 1: Setting up and IoT

Changed:
<
<

Session 2: Micropython and
Hardware access

Uli Raich
Formally CERN, Geneva, Switzerland

>
>

Session 2: Micropython and

Hardware access

Uli Raich

Formally CERN, Geneva, Switzerland

 

The WeMos D1 mini CPU card

esp8266.png wemosEsp32.png

ESP8266

cost: 2.21 Euros

ESP32

cost: 4.1o Euros

Line: 42 to 42
 

How to program the processor

Changed:
<
<
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see
https://docs.espressif.com/projects/esp-idf/en/latest/

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:
https://www.arduino.cc/en/Main/Software

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc/

>
>
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see:
https://docs.espressif.com/projects/esp-idf/en/latest

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:

https://docs.espressif.com/projects/esp-idf/en/latest

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc

 

Flashing the code

Line: 151 to 151
  The Linux version did not work for me
Changed:
<
<
I found a version based on PyQt5 (new version of QT) which was even worse.
>
>
I found a version based on PyQt5 (new version of QT) which was even worse.
 
Changed:
<
<
I tried to correct as much as I could to make the PyQt5 version usable on Linux:
>
>
I tried to correct as much as I could to make the PyQt5 version usable on Linux:
  https://github.com/uraich/uPyCraft-Qt5
Line: 295 to 294
  neopixelCode.png
Added:
>
>

The I2C bus

I2C stands for Inter-Integrated-Circuit. It was invented by Philips Semiconductor

in 1982. Slow, short distance.

Quite a number of sensors in the "WeMos D1 sensor shield collection use the I2C bus

  • SHT30 temperature and humidity sensor
  • DS1307 real time clock
  • The BMP180 barometric pressure and temperature sensor

  • The SSD1306 OLED (Organic Light Emitting Diode) display

The physical bus

The CPU (master) connects to the sensors (slaves) through

2 digital lines:

  • SCL: the clock
  • SDA: the data

i2cBus.png

I2C start and stop sequence

When the master want to talk to the slave it issues a start sequence

It terminates the transfer with a stop sequence

i2cStartStop.png

I2C addressing

When talking to a slave the master sends a seven bit address

followed by a read/write bit

This allows to access at most 128 devices

i2cAddress.png

I2C data transfer

Data is transmitted 8 bits at a time followed by an acknowledge bit.

If acknowledge is low, transfer ok, otherwise: send stop sequence

i2cData.png

I2C write cycle

  • Send start sequence
  • Send I2C address and R/W bit low
  • Send internal register number
  • Send data byte
  • Optionally send further data bytes
  • Send stop sequence

I2C read cycle

  • Send start sequence
  • Send slave address with R/W low
  • Send address of internal register
  • Send a start sequence again
  • Send slave address with R/W high
  • Read data byte
  • Send stop sequence

I2C in Micropython

i2c_uP.png

Scanning the I2C bus

i2cScan.png

The SHT30 digital temperature and relative humidity sensor

The SHT30 is a digital temperature and humidity sensor based on the I2C bus

Here is its data sheet.

Temperature precision: +- 0.3 °C

Relative humidity: +- 3 %

Works on 2.4V – 5.5 V

sht30Block.png

A look at the SHT30 driver

https://afnog.iotworkshop.africa/pub/AFNOG/HardwareAccessAndMicropython/sht30.py.txt

Reading out the SHT30

sht30Code.png

Results from the SHT30

sht30Results.png

WeMos D1 mini sensor and actuator shields (1)

wemosButton.png wemosWS2812.png wemosOLED.png
Pushbutton WS2812 cascadable rgb LED SSD1306 OLED display
wemosDS18B20.png wemosDHT11.png wemosLedMatrix.png
DS118B20 temperature sensor DHT11 temperature and relative humidity sensor 8x8 LED Matrix

Wemos D1 mini sensor and actuator shields (2)

wemosBuzzer-v2.png wemosDataLogger-v2.png wemosSHT30.png
Passive Buzzer Data Logger SHT30 temperature and humidity sensor
tripleBase.png proto.png
triple base my prototype board: LED + photo resistor

Pinouts of shields

shieldPins.png

Documentation for the demo programs

Demo programs for all the shields are available on github:

https://github.com/uraich/MicroPython_IoTDemos

A short description of every program can be found in the README

The data logger

The data logger features a DS1307 Real Time Clock (RTC) backed up by a battery

An SD card socket also provided.

This allows to store large amounts of data locally

The RTC keeps the time and measurements can be supplied with a time tag

Programs to set and read the RTC are provided.

One of the programs setting the RTC gets the time from and NTP server

such that manual specification of the current date and time are not needed.

wemosDataLogger-v2.png
https://github.com/uraich/MicroPython_IoTDemos/tree/master/drivers/ds1307

The push button shield

pushbuttonCode.png wemosButton.png

DS18B20 shield

ds18b20Code.png wemosDS18B20.png
   

SSD1306 48x64 OLED display

This one is also an I2C device


It provides 48*64 pixels and allows to

  • Write a few characters of text
  • Do simple graphics
The ssd1306 class inherits from the


framebuf class included in Micropython such that all

drawing methods of the framebuf are available for drawing:


https://docs.micropython.org/en/latest/library/framebuf.html


For an example see:

https://github.com/uraich/MicroPython_IoTDemos/tree/master/drivers/oled

wemosOLED.png

The DHT11 shield

dht11Code.png wemosDHT11.png
The DHT11 is a digital temperature
and relative humidity sensor. It uses
a proprietary protocol of
communication with its controlling
host implemented in the
dht.DHT11 class

The LED matrix

The LED matrix has 8x8 LEDs on it, which can individually be switched on or off.

In addition to the mled class which takes care of the communication between the host

and the device and which has classes to clear the display,

set a pixel on or off and to change the brightness,

I wrote a class matrix which takes a number 0..64 and

lights this number of LEDs starting from bottom left

wemosLedMatrix.png

The buzzer

This shield implements a passive buzzer.

A passive buzzer takes a frequency(an active buzzer takes a signal level)

and produces a sound at this frequency.


This means that the frequency can be changed and a tune can be played.

In

https://github.com/uraich/MicroPython_IoTDemos/tree/master/drivers/buzzer

you will find a program interpreting songs on

RTTTL (Ring Tone Text Transfer Language)

and playing these on the buzzer

A small song library is also provided

wemosBuzzer-v2.png

The prototype module

This is a home build module featuring a photo-resistor

measuring the light intensity impinging on it.

It provides an analogue value converted to digital

by the ADC on the WeMos D1 CPU

Please note that the ESP8266 has a single 10 bit ADC

while the ESP32 has 3 12 bit ADCs.

A MUX provides up to 18 analogue channels


The light intensity can be changed with an LED

proto.png

The triple base

This module allows to easily stack a rather larger number of shields to a sandwich.

Make sure however that the GPIO lines used by the modules do not clash

tripleBase.png

Exercises

Now it is up to

You

to do the work!


The exercises are here:

https://afnog.iotworkshop.africa/do/view/AFNOG/Session2

 %SLIDESHOWEND%

Uli Raich - 2019-05-13

Line: 335 to 525
 
META FILEATTACHMENT attachment="ws2812Chain.png" attr="" comment="" date="1557837762" name="ws2812Chain.png" path="ws2812Chain.png" size="20395" user="UliRaich" version="1"
META FILEATTACHMENT attachment="neopixelCode.png" attr="" comment="" date="1557838009" name="neopixelCode.png" path="neopixelCode.png" size="81843" user="UliRaich" version="1"
META FILEATTACHMENT attachment="neopixel.png" attr="" comment="" date="1557838010" name="neopixel.png" path="neopixel.png" size="169433" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="i2cAddress.png" attr="" comment="" date="1557842993" name="i2cAddress.png" path="i2cAddress.png" size="1289" user="UliRaich" version="1"
META FILEATTACHMENT attachment="i2cBus.png" attr="" comment="" date="1557842993" name="i2cBus.png" path="i2cBus.png" size="1675" user="UliRaich" version="1"
META FILEATTACHMENT attachment="i2cStartStop.png" attr="" comment="" date="1557842993" name="i2cStartStop.png" path="i2cStartStop.png" size="2722" user="UliRaich" version="1"
META FILEATTACHMENT attachment="i2cData.png" attr="" comment="" date="1557843941" name="i2cData.png" path="i2cData.png" size="1286" user="UliRaich" version="1"
META FILEATTACHMENT attachment="i2c_uP.png" attr="" comment="" date="1557843981" name="i2c_uP.png" path="i2c_uP.png" size="254570" user="UliRaich" version="1"
META FILEATTACHMENT attachment="i2cScan.png" attr="" comment="" date="1557844339" name="i2cScan.png" path="i2cScan.png" size="138064" user="UliRaich" version="1"
META FILEATTACHMENT attachment="sht30Block.png" attr="" comment="" date="1557844867" name="sht30Block.png" path="sht30Block.png" size="27925" user="UliRaich" version="1"
META FILEATTACHMENT attachment="sht30.py.txt" attr="" comment="" date="1557845020" name="sht30.py.txt" path="sht30.py.txt" size="6612" user="UliRaich" version="1"
META FILEATTACHMENT attachment="sht30Code.png" attr="" comment="" date="1557845226" name="sht30Code.png" path="sht30Code.png" size="87083" user="UliRaich" version="1"
META FILEATTACHMENT attachment="sht30Results.png" attr="" comment="" date="1557845238" name="sht30Results.png" path="sht30Results.png" size="172569" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosWS2812.png" attr="" comment="" date="1557845717" name="wemosWS2812.png" path="wemosWS2812.png" size="147704" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosOLED.png" attr="" comment="" date="1557845721" name="wemosOLED.png" path="wemosOLED.png" size="142541" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosButton.png" attr="" comment="" date="1557845726" name="wemosButton.png" path="wemosButton.png" size="116035" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosDHT11.png" attr="" comment="" date="1557845732" name="wemosDHT11.png" path="wemosDHT11.png" size="116136" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosDS18B20.png" attr="" comment="" date="1557845736" name="wemosDS18B20.png" path="wemosDS18B20.png" size="73173" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosLedMatrix.png" attr="" comment="" date="1557845743" name="wemosLedMatrix.png" path="wemosLedMatrix.png" size="112402" user="UliRaich" version="1"
META FILEATTACHMENT attachment="tripleBase.png" attr="" comment="" date="1557846667" name="tripleBase.png" path="tripleBase.png" size="200805" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosSHT30.png" attr="" comment="" date="1557846679" name="wemosSHT30.png" path="wemosSHT30.png" size="105373" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosDataLogger.png" attr="" comment="" date="1557846695" name="wemosDataLogger.png" path="wemosDataLogger.png" size="270203" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosBuzzer.png" attr="" comment="" date="1557846714" name="wemosBuzzer.png" path="wemosBuzzer.png" size="258738" user="UliRaich" version="1"
META FILEATTACHMENT attachment="shieldPins.png" attr="" comment="" date="1557846782" name="shieldPins.png" path="shieldPins.png" size="69919" user="UliRaich" version="1"
META FILEATTACHMENT attachment="protoBoard.png" attr="" comment="" date="1557846824" name="protoBoard.png" path="protoBoard.png" size="904008" user="UliRaich" version="1"
META FILEATTACHMENT attachment="proto.png" attr="" comment="" date="1557846884" name="proto.png" path="proto.png" size="116931" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosDataLogger-v2.png" attr="" comment="" date="1557847299" name="wemosDataLogger-v2.png" path="wemosDataLogger-v2.png" size="74486" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosBuzzer-v2.png" attr="" comment="" date="1557847306" name="wemosBuzzer-v2.png" path="wemosBuzzer-v2.png" size="111488" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ds18b20Code.png" attr="" comment="" date="1557848024" name="ds18b20Code.png" path="ds18b20Code.png" size="66399" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pushbuttonCode.png" attr="" comment="" date="1557848026" name="pushbuttonCode.png" path="pushbuttonCode.png" size="67126" user="UliRaich" version="1"
META FILEATTACHMENT attachment="dht11Code.png" attr="" comment="" date="1557852263" name="dht11Code.png" path="dht11Code.png" size="55780" user="UliRaich" version="1"

Revision 42019-05-14 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"

Start Presentation

Slide 1: Setting up and IoT

Line: 41 to 41
 

How to program the processor

Changed:
<
<
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see
https://docs.espressif.com/projects/esp-idf/en/latest/

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:
https://www.arduino.cc/en/Main/Software

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc/
and
https://github.com/micropython/micropython/

>
>
esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see
https://docs.espressif.com/projects/esp-idf/en/latest/

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:
https://www.arduino.cc/en/Main/Software

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc/

Flashing the code

esptool.png

esptool

  • esptool is called from the Makefiles in ESP-IDF
  • esptool is used when we upload code from the Arduino IDE to the processor flash
  • esptool is used when the Micropython IDE uPyCraft

    installs Micropython onto the processor flash
In the above cases the use of esptool is hidden to us.

We can however also execute esptool directly.

How to write a Micropython program?

First we need a Micropython interpreter!

You find the sources here:

https://github.com/micropython/micropython/

In the repository you find ports for the ESP8266 and the ESP32.

In order to compile the code you need the ESP-IDF and its cross compilers

The code compiles into a binary file (firmware-combined.bin) which contains a boot loader and the interpreter.

This binary must be uploaded and flashed.

For documentation of the ESP8266 port of Micropython look at

https://docs.micropython.org/en/latest/esp8266/tutorial/index.html

How to communicate with the Micropython interpreter?

We use a serial connection passing through the micro USB connection.

As soon as we connect the processor card to the PC we see the

UART bridge and a new device: dev/ttyUSB0 is created.

This device is used to communicate with the Micropython REPL.

lsusb.png

You see the command prompt and you can interact with Micropython. But … how to upload scripts?

What is REPL?

repl.png

The communication tools: minicom

minicom.png

You see the command prompt and you can interact with Micropython.

But … how to upload scripts?

The command line tool ampy

ampy.png

IDE for Micropython: uPyCraft

uPyCraft.png

uPyCraft

uPyCraft is a rather complete Integrate Development Environment (IDE)

which lets you

  • Access the REPL

  • Create directories on the Micropython file system

  • Upload scripts

  • Syntax check scripts

  • Run scripts

  • Install Micropython on your processor board

Flashing Micropython

This has already been done for you! However, it is easy if you want to do it

at home with a new processor board.

Compiling a new version of Micropython is substantially harder but also perfectly possible.

updateFirmware.png

uPyCraft(2)

uPyCraft is based on QT4 and is available for Linux, Windows and Mac.

It is written in PyQt4 the Python language binding to Qt4.

The Linux version did not work for me

I found a version based on PyQt5 (new version of QT) which was even worse.

I tried to correct as much as I could to make the PyQt5 version usable on Linux:

https://github.com/uraich/uPyCraft-Qt5

Thonny

thonny.png

Thonny (2)

Thonny is an IDE for Python which has provisions for Micropython.

Under Tools → Options button you can select the type of

Python interpreter you intend to use.

thonny_uP.png

IoT Hello World program

A “Hello World” program, just printing “Hello World” on the screen

does not look very exciting.

However, this is generally used to verify that the infrastructure

Compiler, linker, downloader, flash program

are working correctly

In embedded systems printing can be quite complex

and a blinking LED is used instead.

Switching on and off a LED

The ESP8266 and the ESP32 have a “user LED” connected to GPIO 2.

How do we control this LED?

  • Define that the LED is connected to GPIO 2

  • Program this pin as output

  • Write a logic 1 to the pin to switch it on

  • Write a logic 0 to the pin to switch it off

  • The logic state may be inverted if the LED is active low

Micropython hardware functions

hardwareFunctions.png

The machine.Pin class

pinClass.png

Switch the LED on, version 1

ledControl1.png

Switch the LED on, version 2

ledControl2.png

The blinking LED

Now we put the code into a script and run it

blinkingLed.png

Changing the light intensity

The LED is connected to a digital line which can only be set to 0 or Vcc.

How can we change the light intensity and dim the LED?

The light intensity depends on the average current flowing through the LED.

The answer is PWM: pulse width modulation.

pwm.png

PWM in Micropython

pwm_uP.png

Our PWM implementation

pwmImpl.png

The WS2812B LED

A more complex LED:

  • rgb LED used in LED chains.

  • each ws18b12 contains the 3 colored LEDs and a controller.

  • Can be cascaded and individually addressed, depending on its position in the chain

  • Needs precise timing

  • To use it we pass through the neopixel library built into MicroPython

WS2812B timing

For all the details on the ws2812b look at

https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf

24 bit of colour data puts 2e24 colours at your disposal

Coding of a single bit

ws2812Bits.png

The control word:

ws2812ControlWord.png

Cascading the WS2812B

ws2812Chain.png

Using the neopixel library

neopixel.png

… and our code

We have a single neopixel connected to

GPIO pin 4 (ESP8266)

or

GPIO pin 21 (ESP32)

This code works on both CPUs!

neopixelCode.png

  %SLIDESHOWEND%
Line: 60 to 312
 
META FILEATTACHMENT attachment="esp8266PinMeaning.png" attr="" comment="" date="1557826991" name="esp8266PinMeaning.png" path="esp8266PinMeaning.png" size="159054" user="UliRaich" version="2"
META FILEATTACHMENT attachment="esp32-pinout-chip-ESP-WROOM-32.png" attr="" comment="" date="1557827435" name="esp32-pinout-chip-ESP-WROOM-32.png" path="esp32-pinout-chip-ESP-WROOM-32.png" size="140701" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp8266Programming.png" attr="" comment="" date="1557827999" name="esp8266Programming.png" path="esp8266Programming.png" size="110920" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="esptool.png" attr="" comment="" date="1557833294" name="esptool.png" path="esptool.png" size="117090" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ampy.png" attr="" comment="" date="1557834128" name="ampy.png" path="ampy.png" size="103088" user="UliRaich" version="1"
META FILEATTACHMENT attachment="minicom.png" attr="" comment="" date="1557834128" name="minicom.png" path="minicom.png" size="17594" user="UliRaich" version="1"
META FILEATTACHMENT attachment="uPyCraft.png" attr="" comment="" date="1557834224" name="uPyCraft.png" path="uPyCraft.png" size="168023" user="UliRaich" version="1"
META FILEATTACHMENT attachment="repl.png" attr="" comment="" date="1557834352" name="repl.png" path="repl.png" size="20712" user="UliRaich" version="1"
META FILEATTACHMENT attachment="lsusb.png" attr="" comment="" date="1557834499" name="lsusb.png" path="lsusb.png" size="75021" user="UliRaich" version="1"
META FILEATTACHMENT attachment="updateFirmware.png" attr="" comment="" date="1557835184" name="updateFirmware.png" path="updateFirmware.png" size="28006" user="UliRaich" version="1"
META FILEATTACHMENT attachment="thonny.png" attr="" comment="" date="1557835519" name="thonny.png" path="thonny.png" size="151691" user="UliRaich" version="1"
META FILEATTACHMENT attachment="thonny_uP.png" attr="" comment="" date="1557835519" name="thonny_uP.png" path="thonny_uP.png" size="31716" user="UliRaich" version="1"
META FILEATTACHMENT attachment="blinkingLed.png" attr="" comment="" date="1557836268" name="blinkingLed.png" path="blinkingLed.png" size="81840" user="UliRaich" version="1"
META FILEATTACHMENT attachment="hardwareFunctions.png" attr="" comment="" date="1557836278" name="hardwareFunctions.png" path="hardwareFunctions.png" size="163326" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ledControl1.png" attr="" comment="" date="1557836279" name="ledControl1.png" path="ledControl1.png" size="20266" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ledControl2.png" attr="" comment="" date="1557836280" name="ledControl2.png" path="ledControl2.png" size="20228" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pinControl2.png" attr="" comment="" date="1557836292" name="pinControl2.png" path="pinControl2.png" size="20228" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pinClass.png" attr="" comment="" date="1557836436" name="pinClass.png" path="pinClass.png" size="163942" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pwm.png" attr="" comment="" date="1557836874" name="pwm.png" path="pwm.png" size="52678" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pwmImpl.png" attr="" comment="" date="1557837072" name="pwmImpl.png" path="pwmImpl.png" size="119544" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pwm_uP.png" attr="" comment="" date="1557837072" name="pwm_uP.png" path="pwm_uP.png" size="25235" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ws2812Bits.png" attr="" comment="" date="1557837762" name="ws2812Bits.png" path="ws2812Bits.png" size="12144" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ws2812ControlWord.png" attr="" comment="" date="1557837762" name="ws2812ControlWord.png" path="ws2812ControlWord.png" size="7754" user="UliRaich" version="1"
META FILEATTACHMENT attachment="ws2812Chain.png" attr="" comment="" date="1557837762" name="ws2812Chain.png" path="ws2812Chain.png" size="20395" user="UliRaich" version="1"
META FILEATTACHMENT attachment="neopixelCode.png" attr="" comment="" date="1557838009" name="neopixelCode.png" path="neopixelCode.png" size="81843" user="UliRaich" version="1"
META FILEATTACHMENT attachment="neopixel.png" attr="" comment="" date="1557838010" name="neopixel.png" path="neopixel.png" size="169433" user="UliRaich" version="1"

Revision 32019-05-14 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"
Deleted:
<
<

Hardware access and Micropython

  Start Presentation

Changed:
<
<

Setting up an IoT

Session 2: Micropython and
Hardware access

Uli Raich
Formally CERN, Geneva, Switzerland

>
>

Setting up and IoT

Session 2: Micropython and
Hardware access

Uli Raich
Formally CERN, Geneva, Switzerland

 

The WeMos D1 mini CPU card

Changed:
<
<
esp8266.png wemosEsp32.png
ESP8266 CPU ESP32 CPU
>
>
esp8266.png wemosEsp32.png

ESP8266

cost: 2.21 Euros

ESP32

cost: 4.1o Euros

 

Changed:
<
<

CPU PinOut

esp8266Pinout.png esp32Pinout.png
>
>

CPU Pinout

esp8266Pinout.png esp32Pinout-v2.png
 
ESP8266 ESP32
Added:
>
>
Please note: The pin numbers IOxx on the ESP32 correspond

to the GPIO pin numbers

 
Changed:
<
<
Please note that the numbers IOxx for the ESP32 correspond to the GPIO numbers.
>
>
The pins in the white fields go to the WeMos D1 mini bus
 
Changed:
<
<
So..., IO22 corresponds to GPIO 22.
>
>
and are also available on the ESP8266
 
Changed:
<
<
The same is not valid for the numbers Dx in the ESP8266 case.
>
>
The other pins are only accessible on the ESP32 CPU card
 
Changed:
<
<
Please see the next slide for the correspondence.
>
>
The pin numbers Dx do not correspond to GPIO pin numbers!

Please refer to the next slide for correspondence

 

Changed:
<
<

Comparison PinOut
ESP8266 versus ESP32 for reference

>
>

CPU pinouts for reference

  cpuPinouts.png
Added:
>
>

Meaning of pins on ESP8266

  • GPIO: General Purpose Input Output.
    Drives a single digital line which
    can be programmed input or output
  • SCL/SDA: The I2C bus:a 2 wire bus
    interfacing sensors or actuators to the CPU

  • SCL,MISO,MOSI,SS: SPI
    the Serial Peripheral Interface.
    Used fast communication with external device
esp8266PinMeaning.png

Meaning of pins on ESP32

esp32-pinout-chip-ESP-WROOM-32.png

How to program the processor

esp8266Programming.png Several development tools are available:
  • ESP_IDF: The official Espressif development tool.
    Includes a gcc compiler for the ESP8266 and the ESP32

Please see
https://docs.espressif.com/projects/esp-idf/en/latest/

  • The Arduino IDENeeds extensions for these processors
    and the different CPU boards

see:
https://www.arduino.cc/en/Main/Software

  • MicroPython

see:
https://micropython-docs-esp32.readthedocs.io/en/esp32_doc/
and
https://github.com/micropython/micropython/

 %SLIDESHOWEND%

Uli Raich - 2019-05-13

Line: 41 to 55
 
META FILEATTACHMENT attachment="wemosEsp32.png" attr="" comment="" date="1557779391" name="wemosEsp32.png" path="wemosEsp32.png" size="218419" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cpuPinouts.png" attr="" comment="" date="1557779532" name="cpuPinouts.png" path="cpuPinouts.png" size="34918" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp8266Pinout.png" attr="" comment="" date="1557780096" name="esp8266Pinout.png" path="esp8266Pinout.png" size="180678" user="UliRaich" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="esp32Pinout.png" attr="" comment="" date="1557780235" name="esp32Pinout.png" path="esp32Pinout.png" size="318749" user="UliRaich" version="1"
>
>
META FILEATTACHMENT attachment="esp32Pinout-v2.png" attr="" comment="" date="1557824478" name="esp32Pinout-v2.png" path="esp32Pinout-v2.png" size="154832" user="UliRaich" version="1"
META FILEATTACHMENT attachment="afnog19-ws-session2.odp" attr="" comment="" date="1557824492" name="afnog19-ws-session2.odp" path="afnog19-ws-session2.odp" size="6585835" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp8266PinMeaning.png" attr="" comment="" date="1557826991" name="esp8266PinMeaning.png" path="esp8266PinMeaning.png" size="159054" user="UliRaich" version="2"
META FILEATTACHMENT attachment="esp32-pinout-chip-ESP-WROOM-32.png" attr="" comment="" date="1557827435" name="esp32-pinout-chip-ESP-WROOM-32.png" path="esp32-pinout-chip-ESP-WROOM-32.png" size="140701" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp8266Programming.png" attr="" comment="" date="1557827999" name="esp8266Programming.png" path="esp8266Programming.png" size="110920" user="UliRaich" version="1"

Revision 22019-05-13 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WorkshopSlides"

Hardware access and Micropython

Changed:
<
<
Here are the original slides:
>
>
Start Presentation

 
Changed:
<
<
-- Uli Raich - 2019-05-13
>
>

Setting up an IoT

Session 2: Micropython and
Hardware access

Uli Raich
Formally CERN, Geneva, Switzerland

The WeMos D1 mini CPU card

esp8266.png wemosEsp32.png
ESP8266 CPU ESP32 CPU

CPU PinOut

esp8266Pinout.png esp32Pinout.png
ESP8266 ESP32

Please note that the numbers IOxx for the ESP32 correspond to the GPIO numbers.

So..., IO22 corresponds to GPIO 22.

The same is not valid for the numbers Dx in the ESP8266 case.

Please see the next slide for the correspondence.

Comparison PinOut
ESP8266 versus ESP32 for reference

cpuPinouts.png

%SLIDESHOWEND%

Uli Raich - 2019-05-13

 

Comments

<--/commentPlugin-->
Added:
>
>
META FILEATTACHMENT attachment="esp8266.png" attr="" comment="" date="1557779237" name="esp8266.png" path="esp8266.png" size="118895" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wemosEsp32.png" attr="" comment="" date="1557779391" name="wemosEsp32.png" path="wemosEsp32.png" size="218419" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cpuPinouts.png" attr="" comment="" date="1557779532" name="cpuPinouts.png" path="cpuPinouts.png" size="34918" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp8266Pinout.png" attr="" comment="" date="1557780096" name="esp8266Pinout.png" path="esp8266Pinout.png" size="180678" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp32Pinout.png" attr="" comment="" date="1557780235" name="esp32Pinout.png" path="esp32Pinout.png" size="318749" user="UliRaich" version="1"

Revision 12019-05-13 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WorkshopSlides"

Hardware access and Micropython

Here are the original slides:

-- Uli Raich - 2019-05-13

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback