Learn ESP32 Microcomputer: Sensors-Code-Actuators

From ArduinoInfo
Jump to navigation Jump to search

INTRO

The objective of this course (and hardware kit) is to provide students with the courseware, hardware and software to deeply engage with Electronics, Microcomputers, Software , Data and Communications. It will not assume any previous knowledge or experience other than basic computer operations.

This is a cooperative development effort between Terry King (currently USA), Jun Peng (China), Elden Montagne (Guyana), Char Wangkor (Egypt, South Sudan) , Glenn Mason (Connecticut USA) , Hudson Lusk (Connecticut USA), and with help and discussion from many others

THIS Wiki page as of now is just a working Info document for those of us designing and critiquing this approach. It is NOT useable Courseware ! We'll see how it actually develops.

We will use much of the approach we were recently working on in this Wiki: SEE HERE

It will have a more beginner-student approach and will separate out the “Learning Electronics” part.

WHY ARE WE DOING THIS?

Over several years and continents we have designed and used and made several kits for use by students to learn "Arduino and sensors and actuators". The content may be good, but the whole thing comes into focus when a teacher has 10+ students with kits on their desk and they start trying to connect things up. Soon 3 kids at once are saying "It Doesn't WORK!"..

The original Arduino had two rows of female sockets that users had to plug wires and things into. Fussy Fussy. Creating an Arduino version with 3-pin connectors on every I/O pin helped a lot. Then getting sensors and actuators that were mounted on little PC boards ("Electronic Bricks") and 3-pin cables was a LOT better. And that is a good environment when students have learned quite a bit and start making their own projects.

But the very first student encounter with an Arduino/ESP32 and wires and connections, and software they have not used before and concepts they have not encountered before is a Difficult Moment! The teacher may encounter multiple simultaneous Difficult Moments.

The idea of this course / kit is to have students take one step at a time.

  1. Use the "Inventor Board" for their first learning experience. It has a good selection of sensors and actuators that are permanently mounted with good labeled pins to connect to them. It is like a "Breadboard" with many parts on it. The devices are not yet connected to the ESP32 but have good, labelled pins. They already have ground and voltage connected. Many fewer wires are needed to make things work. Studenst will:
    1. Learn what the parts DO.
    2. Combine multiple parts and demonstrate interesting projects.
    3. Learn many new concepts.
  2. Learn some other individual devices that are separate parts that are not on the Inventor Board. Connect them and make them work. (Most of the Inventor Board parts are available as Electronic Bricks). .
  3. Make a compact project with the same ideas and parts but now use a small "Arduino Size" ESP32 board (SEE it HERE) that now connects to the other parts. That board costs about $10 and can be dedicated to working projects. Mount those devices on a board or box to make a working project that uses the smaller Arduino-size board. Maybe keep that as a "permanent: project and go back to the Inventor Board to continue learning software and communications skills. The ESP32 has both Bluetooth and Wifi built in. So it can connect to smartphones and networks and browsers on phones or computers. The "Internet Of THINGS".

HARDWARE:

Keyes ESP32 Inventor Kit Board

We will use a Keyes ESP32 Inventor Kit Board where students will begin learning Microcomputers, Sensors, Actuators and SCRATCH type Drag-Drop and C++ coding. We have met and worked with Keyestudio in China and Jun Peng works directly with them in Shenzhen now.

The Inventor Kit is currently available on Amazon HERE: but we will import it directly from Keyes in China. InShaAllah. InShaTariff.

The inventor kit is a single board like a "Breadboard" with many parts. A BREADBOARD (W) is a flat board that can be used to connect many devices. NOTE: A LINK like this one with "(W)" means click to go to WIKIPEDIA for more information.

The Inventor Board comes with an ESP32 plugin board in a small box in the kit package. The main Inventor kit looks like this:

InventorStarterBoard2048.jpg


The ESP32 plugin board that you will need to plug onto the main board looks like this: Keyes ESP-32 Module.png


SENSORS AND ACTUATORS

The Inventor kit includes several Sensors and Actuators we will use, as well as Bluetooth and Wifi Communications. Here’s a look at the parts we can connect to on the kit:

InventorBoardDevices2048.jpg



Here’s the list:

  • four buttons
  • four LEDs (red, yellow, green and blue)
  • six WS2812 RGB LEDs
  • Passive Beeper
  • PIR motion sensor
  • IR receiver
  • sound sensor
  • photoresistor
  • 8002 Amplifier and Speaker
  • potentiometer
  • ultrasonic sensor
  • Digital Tube display
  • LCD 16x2 Display

Added Parts

We will add several devices and parts to the overall kit that are not included on the Inventor Board:

  • Joystick
  • Stepper Motor
  • dc motor
  • power NFET transistor
  • Cables. Pins etc.

ESP32 PLUS Board for Projects

The Inventor Kit board is great for much of a class covering Sensor and Actuator concepts, and Software coding to create working examples etc. BUT when students get to making their own projects we will include a smaller ESP32 board with similar capabilities to which they will need to add separate components to make up their design. This board has the Arduino shape and pins PLUS 3-pin connections for all I/O and built-in ESP32. It looks like this:

ESP32PLUS Board.jpg



The overall kit will include other small electronics parts. Some of them will be identical to the Inventor Kit devices but as separate parts. Other devices such as those in the second list above will be included.   The overall kit will probably include a motor driver and two geared electric motors with wheels, to support building a “Smart Car”.. often referred to as a “Robot”..

Students Kits VS Classroom Kits

There is an opportunity to create an optional Classroom kit which would include more and different parts and devices for use in projects.

There could be many of the "Electronic Brick" versions of the same parts that are on the Inventor Board, plus a few more complex devices such as Fingerprint Readers, Video Cameras, Gas and Chemical sensors, Temperature sensors with long cables, breadboards, and mechanical parts like plastic or plywood boards, screws, nuts and bolts, adhesives, terminal strips, long range radios etc.

There are a few thousand other possibilities. Click a Few Of These :-) A B C

Hmmm..

SOFTWARE

LEARNING SOFTWARE AND DATA CONCEPTS AND CODING

The Arduino UNO and the ESP32 we are using are usually programmed in the C++ language. A good way to begin programming concepts for students is to use a visual “Drag-and-Drop” system on a desktop/laptop computer. The SCRATCH program developed over years at MIT is a good example, and we will use a version of SCRATCH3 that includes great support for Arduino and ESP32. It is called KIDSBLOCK.

Here is a quick look at KIDSBLOCK where the device that has been selected is the ESP32 inventor kit. A detailed page on using Kidsblock for ESP32 is HERE.

Below the traditional BLINK program has been made by pulling Blocks out from the left menu. A single wire has been connected on the Inventor Kit from IO Pin 5 to RED LED. You can see on the right the C++ text code that has been created from the blocks. The Green UPLOAD button has been clicked and after a lot of “Compile/Build Stuff” rolls by in the system window, the code is uploaded to the ESP32 and it WORKS!

.900px


After that I tried writing some characters on the LCD Display. I connected two wires this time, from SCL and SDA pins on the board to the SCL and SDA pins on the LCD Display. Here’s the example program:

KidsBlockLCD1.jpg
That’s all it took ! to make this work:

InventorBoardGlenn.jpg

WHAT's NEXT?

OK Lots more to work on here.

We need to create the courseware on the Wiki that students will encounter.

Thoughts On Courseware:

There are several things that were confusing about starting to use KIDSBLOCK. It starts up at default in SCRATCH graphics programming mode. That’s fine, and maybe we can USE that with kids starting out, even at younger than HS age. Hmmm..

There IS also a mode in which SCRATCH graphics with sprites and all that can Interact with Arduino or ESP32 so on-screen realtime SCRATCH sketches can interact with hardware. I have not tried that yet, although I understand how it download and uses “Firmata” code on the ESP32 to communicate from SCRATCH sprites etc. WOW, more ???

For ESP32 classes we need to have good How-To to get into the right mode, select the right board, and connect over USB. Here's what we're working on:

INSTALLING KIDSBLOCK

In the past we have used MIXLY which is similar and was based on BLOCKLY from MIT developed by the Beijing University Education University. Now we are using KIDSBLOCK which is based on SCRATCH3 from MIT and includes great support for Arduino and ESP32. It specifically supports the Keyes Inventor.

KIDSBLOCK supports a spectrum of Student Interaction and Learning, starting with the traditional SCRATCH visual based block structured environment with graphics, sprites etc.

KIDSBLOCK supports a broad range of educational hardware, including the Arduino family, Micro:bit, ESP8266, and ESP32 boards, making it versatile for STEM education and creative electronics projects. Students have an almost seamless path from SCRATCH to Electronics and Microcomputers.

Download Software

For Windows System: Windowsdownload.jpg


For MAC System: Macdownload.jpg

KIDSBLOCK SETUP AND USER OPTIONS

NOTES

Coming RealSoonNow :-) OK Terry is back on this part now :-)

There are several things that were confusing about starting to use KIDSBLOCK. It starts up at default in SCRATCH graphics programming mode. That’s fine, and maybe we can USE that with kids starting out, even at younger than HS age. Hmmm..

There IS also a mode in which SCRATCH graphics with sprites and all that can Interact with Arduino or ESP32 so on-screen realtime SCRATCH sketches can interact with hardware. I have not tried that yet, although I understand how it downloads and uses “Firmata” code on the ESP32 to communicate from SCRATCH sprites etc. WOW, more ???

For ESP32 classes we need to have good How-To to get into the right mode, select the right board, and connect over USB. Here's what we're working on:

STARTING UP KIDSBLOCK

GLENN NOTE: Please note differences you see in a MAC install!

Windows install screens

After downloading, start the Kidsblock Installer (WINDOWS= kidsblock.com) MAC = ). You will see these screens:

KB Set1.png KB Set2.png
NOTE: Accept the default location on C: . Alternates not tested yet)


KB Set4.png

You should then see this: ( Wait for completion.)

KB-Firewall.png

You Probably will get one or two popups like this, as it accesses the Arduino main site. Click ALLOW ACCESS.


FIRST KIDSBLOCK STARTUP

There should be a Kidsblock icon (LADYBUG) on your desktop (or start/applications menu) Click on it.

NOTE: Kidsblock takes a LONG time to load! 15 to 30 seconds+. WAIT. Do not click again.

Kbloading.png

You should see a quick screen like this:


After a couple seconds the main Kidsblock screen should appear. It will look like this:. Take some time to look it over. NOTE the leftmost menu from MOTION down to MyBlocks.

KidsblockFirstScreen.png


It will always start in Graphics/sprite mode. You can try some examples.

TRY OUT KIDSBLOCK "SCRATCH" MODE

Kb-events.png

Click on the EVENTS button. Click and drag the (GREEN FLAG) item out to the right area and drop it.


Kb-first.png

Click on MOTION and drag the two blocks shown out to the right. Move them so they click together. Click on the Green Flag (The one UP to the LEFT of the LADYBUG). See the LADYBUG follow your code?? Try other things!

There are Many Examples on the "Tutorials" button on the top banner right

SWITCH TO KIDSBLOCK ESP32/InventorKit MODE

When Kidsblock starts up, on its top bar you will see this, which is default mode.

Kbdefault.png


You need to select the DEVICE you want (Probably "Inventor Kit for ESP32" or "ESP32 Development Board".. ) Here's how to find them:

Click on N0 Device Selected and you will see this page pop up:

Kbselectdevice1.jpg


The Inventor Kit for ESP32 will be found in the KIT option. That page will look like this: Scroll DOWN and Click on the "Inventor Kit for ESP32"

KBDEVINVENT.jpg


This will pop up another page which will try to FIND the Inventor Kit connected to your computer.

KbIK-1.jpg
Now go ahead to plugging in your Inventor kit.


GETTING THE Inventor Kit CONNECTED

Connect your "Inventor Kit for ESP32" by USB cable ("Micro-B" plugged into the USP32 Module) to your computer (USB A with possible USB-A to USB-C adapter for a MAC etc.). Two small red LEDs should light up: One on the small ESP32 module plugged into the Inventor Kit, and one on the lower left of the Inventor Kit.

Id the cable is correct and the Kidsblock install worked correctly so USB drivers were installed, the Kidsblock popup should change to this: (click on CONNECT)

KbIK-2.jpg

Next you should see this: (Click on "Go To Editor" )

KbIK-4.jpg

NOTE: AT the Top Bar of Kidsblock you should see this as The Inventor Kit is sucessfully connected. YOUR COM Port number will likely be different. KbIK-5.jpg


A detailed page on using Kidsblock for ESP32 is HERE.


NOTE: There will be a similar path to using the "ESP32 PLUS Board"



            • Working here **********

ESP RECOMMENDED PIN USEAGE

The following table shows what pins are best to use as inputs or outputs and which ones you need to be cautious of because they have other uses or actions. The pins labelled OK are OK to use for digital Input or Output, and for the other functions they are labelled for such as PWM, Analog In or Out etc.

There is a PDF file available with this diagram and columns for you to note what your project will be using pins for. It's Media:ESP32-RecommendedPinsYourProject.pdf HERE ESP32PinUsage.jpg