Purpose:
- For allowing user to test proper functioning of each component on the Controller Board
- For allowing user to identify appropriate values for each component (e.g. angle for servo or color for NeoPixel/WS2812) for use in the final program
Controller board
This is a circuit board together with a number of sensors and actuators for use with this Controller Board Tester
Please refer to Controller Board on details of the Controller board, including its circuit diagram, Geber file of its PCB, component list, and soldering instructions.
You have to get ready a properly functioning Controller Board in order to run the Controller Board Tester.
How to compile
- Download and install IO_Control library according to IO_Control Library and Installation
- Go to "File" > "Examples" > "IO Control" > "ControlBoardTest", open the project, and compile and upload to the ESP32C3 on the Controller Board
How to use
Compile and upload "sd1105BoardTest.ino" to the ESP32C3 on the Controller board
Open "Serial Monitor". Remember to select "No Line Ending" and "115200 baud" on top right of Serial Monitor
Enter a number and press "Return" key to execute the function. Remember to select the input box to enter anything.
Enter "x" to leave the function.
MPR121
- touch each terminal on MPR121 to show the touch and release time
SH1106
- Enter the following values:
- "width of SH1106" - 128
- "height of SH1106" - 64 (or 32, depending on the actual size of your display)
- "I2C address of SH1106" - 3c
- If you connected a SSD1306 display to the board, the content on the display will show up scrambled. However, the message from the Serial Monitor will still say that it is successful. Note that the ESP32C3 does not know whether you have connected a correct display.
SSD1306
- Enter the following values:
- "width of SH1106" - 128
- "height of SH1106" - 64 (or 32, depending on the actual size of your display)
- "I2C address of SH1106" - 3c
- If you connected a SH1106 display to the board, the content on the display will show up scrambled. However, the message from the Serial Monitor will still say that it is successful. Note that the ESP32C3 does not know whether you have connected a correct display.
NeoPixel (or WS2812)
- Enter the following values:
- "pin number of AddrLED" - 19 (note that it is connected to IO19)
- "number of LEDs of AddrLED" - 4
- For "setRGB"
- index - from 0 to "number of LEDs"-1
- r, g or b - from 0 to 255
- e.g. enter "0,255,0,0" to turn first LED to red
- For "setHSV"
- index - from 0 to "number of LEDs"-1
- h (hue) - from 0 to 360
- s (saturation) - from 0 to 100
- v (value) - from 0 to 100
- Refer to https://www.lifewire.com/what-is-hsv-in-design-1078068
- e.g. enter "1,60,100,50" to turn 2nd LED to yellow, with 100% saturation and 50% intensity
Servo motor
- Enter the following values:
- "pin number(s) of Servo" - 8,18 (IO08 and IO18 are the default pins for servo motor)
- Note:
- you can enter only one pin
- you can enter up to 6 pins for 6 different servo motors. Make sure you have physically connect servo motor to each pin.
- Enter angle(s), according to the number of servos
- e.g. "30,60" for setting angle of first servo (IO08) to 30degree, and second servo (IO18) to 60degree
Tone
- Enter the following values:
- "pin number of Tone" - 13 (note that IO13 is used for the piezo speaker)
- Values to enter in the menu:
- frequency
- For musical note, minimum is 31; refer to https://gist.github.com/mikeputnam/2820675
- Can go up to 20000
- e.g. 261 for Note C
- duty
- from 0 to 1024
- corresponds to loudness
- refer to PWM in Additional Notes for Workshop 2A
- duration
- how long the frequency is on
- in milliseconds (e.g. 1000 = 1second)
- frequency
- Note:
- make sure to connect a piezo speaker to H8 on the controller board to hear the sound generated
PWM
- Enter the following values:
- "pin number(s) for PWM" - 12,13
- Note:
- you can enter only one pin
- you can enter up to 6 pins for 6 different PWM outputs. Make sure you have physically connect a circuit to each pin in order to see the effect
- PWM value
- maximum = 16384, which corresponds to 100% duty cycle
- refer to PWM in Additional Notes for Workshop 2A
- Note:
- IO12 and IO13 are connected to the on-board LED. Changing PWM value will change brightness of these two LEDs.
- Be reminded to remove the piezo speaker from H8, as it is connected to IO13. Otherwise, changing PWM value will have no effect on brightness of the LED at IO13.