Skip to content

TechnocopiaPlant/ForkyRIB

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino and the ESP32 Toolchain and Sloeber Eclipse

This is installed on the lab machines already.

Download and install this, do not change any default values

Sloeber Eclipse install instructions

Instructions to Open Projects in Eclipse

Start a Fresh Arduino Sketch in Sloeber Eclipse

Create a Sketch with Git (STRONGLY recommended)

Create a Sketch without Git (Discouraged)

Install VSCode+PlatformIO

Instructions for setting up VSCode for use in RBE1001

Robot Interface Board

The Robot Interface Board (RIB) is a breakout board for the ESP32-DevKitC Arduino module. The Dev Kit C is a reference design of the ESP32-WROOM-32 module which houses the WiFi and bluetooth Antenae. The ESP32-WROOM-32 module houses an ESP32 microcontroller.

Datasheet

Arduino compatiple DevkitC

ESP32 Microcontroller High level Datasheet, 61 pages

ESP32 Microcontroller Detailed Datasheet, 669 pages

ESP32-DevKitC Arduino module wireing diagram

PCB

Image of  Board

ESP32Dev Board PINMAP

Pin Functions

IO Pin counts

There are 16 I/O pins availible for use in your programs with no external perpheral already using them.

There are 21 I/O pins availible for use in your programs including the 5 output only strapping pins.

There are 27 I/O pins availible for use in your programs by reusing the boot button pin, serial pins and i2c pins for other purposes.

User Button

There is a button connected to pin 0 and is accessible to the users code as a button. If you hold it whild pressing the reset button, however, it will hold the chip in bootloader mode and it will not run your code until the core is reset or programmed over the USB. Once your code starts, this button is availible for use as a button in your code and pressing it will not effect the opperation of the core after your program has started.

Pins to Never Use because they will disrupt programming and opperation:

GPIO 6-11 - These pins are hookups for external system flash and are used by the system flash. Unless you are extending the chips flash capibilities, do not use these.

GPIO 1 and 3 - these are used to program the device and are serial port pins.

Output Only Pins

These pins are strapping pins for the core, if pulled to a different state than the default not boot.

These are strapping pins and have to be in known states at the time of the chip booting. If you use them as outputs, be careful to note the the pull up or down resistor states for each. When using these pins make sure the weak-pull resistor will not interfeare with your intended opperation, and do not add additional weak-pull resistors.

GPIO 2  (pull down)
GPIO 5  (pull up)
GPIO 12 (pull down)
GPIO 13 (pull up)
GPIO 15 (pull up)

Input Only pins (No Pull ups availible, no output modes)

34-39 are input only. They have no output modes at all. Analog input and digital input are availible. Note that there are no input pullups on these pins.

GPIO 35
GPIO 34
GPIO 39
GPIO 36

Availible as Both Input and Output (Pull ups availible)

GPIO 4
GPIO 14
GPIO 16-19
GPIO 21-23
GPIO 25-27
GPIO 32-33

External Use pins

GPIO 0 is the boot pin, if held low during a reset it will prevent the device from booting

GPIO 1 and 3 are the serial port used for programming and print statements. This should not be used for user functions, but can be used if serial functionality is needed.

GPIO 13 Has an LED connected to it on the RIB

GPIO 22 and 21 have 4.7kOhm pullups on them and are connected to the Wii accessory port. These can be used with other i2c devices. See: acamilo#31

GPIO 27 Is connected to the Wii header as controller detect. When the controller is connected, this is pulled to 3.3v. It is open when the controller is not connected.

Availible Servo/PWM/AnalogWrite Pins

The ESP32 can generate up to 16 simultanious Servo signels.

GPIO 4     
GPIO 5    
GPIO 12-19 
GPIO 21-23 
GPIO 25-27 
GPIO 32-33 

Servos, PWM, tone() and Timers

The library ESP32Servo deals with all of the issues of cross allocation of the 4 timers and the associated PWM channels.

Use ESP32Servo objects to control the servo

Use the tone() function provided by ESP32Servo to make tones with PWM's

Use ESP32PWM objects to deal with the sound, or the tone implementation provided inside of ESP32Servo.

The library provides examples for each.

FYI: Inside the library it deals with the allocation and de allocation of timers and the associations of PWM's with a common time base together. What you need to understand is that there are 4 timers. Each timer can produce 4 PWM's at the same frequency but with independent duty cycles. That means you can have 16 hardware controlled PWM, so long as you have no more than 4 different frequencies. Esp32Servo keeps track of the allocation states of the users PWMs and dynamically allocates the correct ledC channel.

Timer Interrupts

To use a timer interrupt, you will want to tell ESP32PWM not to allocate a specific timer.

ESP32PWM::timerCount[0]=4;// this disables timer 0
ESP32PWM::timerCount[2]=4;// this disables timer 2

The timer needs to be disabled before allocating any PWM's. After disabling it will not be used in the PWM allocation system and can be used by a library or by the user as a raw timer for interrupts.

See https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/

ledc functions

DO NOT USE THESE! These are raw API level and are for the pros only. These pure C functions are part of the IDF and are provided for ESP32 programmers that are not using Arduino framework. ESP32Servo uses these functions internally, but manages the interactions between channels for you. The ledc functions spread PWM generation across the timers 0-4 using channels 0-15 in an unintuitive pattern:

/*
 * LEDC Chan to Group/Channel/Timer Mapping
** ledc: 0  => Group: 0, Channel: 0, Timer: 0
** ledc: 1  => Group: 0, Channel: 1, Timer: 0
** ledc: 2  => Group: 0, Channel: 2, Timer: 1
** ledc: 3  => Group: 0, Channel: 3, Timer: 1
** ledc: 4  => Group: 0, Channel: 4, Timer: 2
** ledc: 5  => Group: 0, Channel: 5, Timer: 2
** ledc: 6  => Group: 0, Channel: 6, Timer: 3
** ledc: 7  => Group: 0, Channel: 7, Timer: 3
** ledc: 8  => Group: 1, Channel: 0, Timer: 0
** ledc: 9  => Group: 1, Channel: 1, Timer: 0
** ledc: 10 => Group: 1, Channel: 2, Timer: 1
** ledc: 11 => Group: 1, Channel: 3, Timer: 1
** ledc: 12 => Group: 1, Channel: 4, Timer: 2
** ledc: 13 => Group: 1, Channel: 5, Timer: 2
** ledc: 14 => Group: 1, Channel: 6, Timer: 3
** ledc: 15 => Group: 1, Channel: 7, Timer: 3
*/

Note that timer 0 is used for ledc channels 0, 1, 8, 9 and that those channels will be all effected if the frequency on timer 0 is changed. If you are writing some code that deals with LEDC, then do not use any features of ESP32Servo nor any library that uses timers.

Availible DAC pins

GPIO 25
GPIO 26

These pins when used with analogWrite will produce an 8 bit analog value on the given pin. The value is from 0-3.3v mapped to 0-255 values. The api is to simply use analogWrite().

Interrupt

For code examples: https://techtutorialsx.com/2017/09/30/esp32-arduino-external-interrupts/

Availible interruptable pins are all input pins.

Development Computer Options

Option 1) A lab machine

Availible to all students.

Note that the driver is installed on these computers

Note that Arduino with the ESP32 toolchain is already installed in C:\WPIAPPS\arduino-1.8.3\

Note Eclipse is installed on all workstations with the Sloeber plugin installed.

Option 2) Personal Machine

Supported for this class

Windows 10 Pro

A user name with no " " in the file path. Generally it is safe to use your WPI username as the username on your computer.

Fresh install is genearlly reccomended every 6 months. Install disk are availible to students as a resource from the WPI Helpdesk.

OneDrive and Dropbox conflict with the install process and must be fully removed from the user file paths.

Unsupported OS's

MacOS is unsupported and only intermittantly working. Drivers have been an issue with programming our board, and virtualization of Windows within OSX is tested non-working. If you have Mac OSX please install a fresh copy of Windows 10 nativly and dual boot.

Ubuntu 16.04 is unsupported but works well.

Ubuntu 18.04 is unsupported but works well with some creative directions following. This will take more effort and would require pre-existing proficency in Linux. If you have 18.04 please install Windows 10 or 16.04.

How to get Windows 10 as a Student for free from WPI

To get your student copy of Windows go here: 

https://onlinestore.wpi.edu/

Select windows 10, and download it. For students you get one copy and it is free. 

You can follow this tutorial to install it:

https://www.youtube.com/watch?v=aTVOTY93XXU

Arduino Libraries

HOWTO

For detailed instructions on how libraries work, see: https://www.arduino.cc/en/Guide/Libraries

Open Arduino and select Sketch->Libraries -> Manage Libraries

Which Libraries

1001

ESP32Servo

ESP32Encoder

2001

Search for and install:

ESP32Servo

ESP32Encoder

Esp32SimplePacketComs

SimplePacketComs

2002

Search for and install:

ESP32Servo

ESP32Encoder

Adafruit_BNO055

Adafruit Unified Sensor

Esp32SimplePacketComs

SimplePacketComs

DFRobotIRPosition

FAQ and troubleshooting

"I dont see 'ESP32 Dev Module' as an option in Arduino when I try to select my board..."

"I can compile the code but I do not have a serial port option in Arduino..."

"I can select the correct serial port, put it wont program or times out while programming..."

"I can program it but it but it keeps rebooting over and over..."

  • Null pointers are the #1 cause of this behavior, use print statements to isolate the point where it reboots and check for null pointers. This is the issue 9 out of 10 times.

  • Interrupt issues - Interrupts that access memory that is used by non-interrupt code without a mutex or semiphore. Try disabling the interrupt and if this fixed the reboot issue, then go ahead and implement the mutex locking.

  • Something may also be plugged into one of the off-limits pins, or your code is reconfiguring and messing up one of these pins. See: https://github.com/WPIRoboticsEngineering/RobotInterfaceBoard#pins-to-never-use

"This processor seems more complicated than the Uno and the Mega, why are we using it?"

  • The ESP32 is a faster core at 260Mhz, vs the 16Mhz Uno. It is also dual-core.

  • It has more perpherals needed for building robots, 16x 12 bit ADC, 2x DAC and 16 hardware encoder perpherals

  • It has hardware and software that support WiFi for communications.

  • 32 bit processing with an FPU means complex math is possible on the microcontroller.

  • It is Arduino compatible for programming and Library support

  • It is an open source design of the DevKit-C module, using an open soruce tool-chain

"My eclipse if giving a 'Salt needs to be 8 bytes' error

This error comes from different versions of eclipse fighting over the $HOME/.eclipse/ folder. This folder is where the passwords and keys are stored, however other newer copies of Eclipse use a slightly different format. The two copies fight over control of htat folder. To fix the problem close all copies of Eclipse/Sloeber and then erase that folder. Open Sloeber again and password storage will begin working.

I logged in with my credentials but it's not working (and I have 2fa enabled on my GitHub account)

You need to generate a token and use that in place of a password when storing credentials in Sloeber.

For instructions on creating a token see: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

Use your username as the login ID, and the token in the password field.

About

Electronics board for forky build

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published