Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The Nyboard V1 used by Bittle uses the Atmel ATMEGA328P controller, which only supports only one serial port. We separate the serial port of Nyboard to support more modules. The pins of the serial port are compatible with the 6-pin Arduino Pro Mini. Pin definitions are shown in the table below:
Pin No.
Name
Usage
1
DTR
Modem signal DTRοΌreset NyBoard after serial download finished.
2
RX
ATMEGA328P RX (receive)
3
TX
ATMEGA328P TX (send)
4
5V
5V power for MCU and chips
5
GND
Ground
6
GND
Gron
The default serial baud rate is 115200bps.
There're 3 communication modules for the NyBoard V1:
USB downloader
ESP8266 WiFi module
Bluetooth dual modeοΌEDR & BLEοΌJDY-23
The module uses CH340C USB bridge. Windows10, Linux and MacOS are all drive-free.
Insert the 6-pin(H1) to the NyBoard's downloader and then connect the module with the Micro-USB cable in the package to your PC. Open the Arduino IDE and select the corresponding COM port. You can download the programme and communicate with the NyBoard.
Another usage of the downloader is update the WiFi and bluetooth module's firmware. Plug the module in the female 6-pin socket. We changed the TX and RX pin and make one GND pin to the DTR to reset the WiFi module. The details are written in the chapter of the WiFi and bluetooth manual.
Do not plug the NyBoard and the module at the same time! That will make a mistake.
NyBoard V1 is an upgraded version considering the users' feedback on NyBoard V0. It's compatible with previous versions, yet has some new design to make it easier to use.
It still uses Atmel ATMega328P as the main chip but adopts 16MHz without accelerating it to 20MHz. Now the board is fully compatible with Arduino Uno, much easier for new users to Arduino.
It keeps driving 16 PWM channels with PCA9685. The pin order is altered, but you don't even need to read the indexes on the board, because the pin mapping is handled within the software.
Now the 6-axis motion sensor MPU6050 is designed on the PCB, rather than a stand-alone module soldered above the board. It supports a built-in DMP (Digital Motion Processor) to calculate the motion data, as well as providing raw data for your own fusion and filtering algorithms.
It continues to use an 8KB onboard I2C EEPROM to save constants for skills.
The power system is redesigned to provide a more stable supply. The structure for peripherals is also optimized.
From Jan 1st, 2021, We start to include an official Bluetooth dongle for wirelessly uploading and communication. The default baud rate for all the communication ports is set to be 115200.
The reset button is more accessible on the back of the board.
We added 4 Grove socket to plug-and-play Seeed Studio's extensible modules. We still provide standard 2.54mm through-holes besides the socket.
We added 7 WS2812 RGB LEDs on the board as another form of output and status indicator.
The socket for the battery is now anti-reverse.
The configuration of NyBoard V1_0 is shown as below:
NyBoard V1_0 uses Atmel ATMega328P-MUR as the main controller. We adopted its smaller version of QFN32 for better layout, and it's near-identical to regular TQFP32.
ATMega328P works at 16MHz with a 5V supply. It has 2KB SRAM, 32KB Flash, and 1KB on-chip EEPROM. With the same bootloader of Arduino Uno, you can upload sketches through the serial port.
The main chip runs at 5V, while the other peripherals run at a 3.3V logic level. We use PCA9306 to convert the I2C bus of ATMega328P to 3.3V. We also added an I2C switch on the bus. By dialing it to "Arduino" or "Raspberry Pi", you can change the I2C master of the onboard peripherals.
MPU6050 is widely used in many DIY projects to acquire the motion state of devices. It detects the 3 acceleration and 3 angular motion states. It also includes a DMP to calculate the state directly, without using the main controller's computational resources.
On NyBoard V1_0, its I2C address is 0x68. The interrupt pin is connected to the PD2 port of ATMega328P (or the D2 pin of Arduino Uno).
There are a lot of available MPU6050 libraries and we are using I2CDev/6050DMP. You can also use other versions:
Name
Author
Feature
I2Cdev
jrowberg
built-in DMP
Adafruit MPU6050
Adafruit
standard MPU6050 library
Kalman Filter
TKJ Electronics
with Kalman filter
PCA9685 fans out 16 PWM 12-bit channels with instructions from the I2C port. Its address is set to 0x40. There are 16 PWM indexes printed on the PCB, but you don't really need to read them because the pin-mapping is done in the software. The physical wiring pattern is the same as the previous boards. You do need to check the direction of the servo pins. Regular servos have 3 pins for PWM, power(2S), and ground (GND). The ground should connect to the black wire of the servo.
On NyBoard V1_0, the servos' power connects to the 2S Li-ion battery. We designed our servos to be compatible with 8.4V input. Regular servos usually run at 6V. You should not connect regular 9g servos like the SG90 to the board directly.
We use Adafruit PWM Servo Driver Library for PCA9685.
We save the motion skills with an 8KB onboard I2C EEPROM AT24C64. Its I2C address is 0x54. The lookup table of skills is saved in the 1KB on-chip EEPROM of ATMega328P. It uses <EEPROM.h>. You need to pay attention to their differences when developing new codes.
The buzzer is driven by PD5 (or the D5 of Arduino UNO). The current is amplified by 2N7002 MOS.
We use VS1838B as the Infrared receiver, connected to PD4 (or D4 on Arduino Uno). It's driven by the IRremote library of Arduino, the corresponding remote is encoded in NEC format. You may disable the other protocols in IRremote.h to save Flash (about 10%!)
The two LEDs in the Petoi logo indicates the powering state of the board. The left eye is blue for the logic chips. The right eye is yellow for the servos' power. When NyBoard is connected to the battery, both LEDs should lit up. When NyBoard is powered by the USB downloader, only the blue LED will lit up.
There's an anti-reverse socket for the battery. The battery's output is connected to ADC7 (or A7 of Arduino Uno) and is not threaded to an open pin. ADC7 collects the voltage over a voltage divider. The actual voltage is approximately 2x of the reading. A safe range of battery voltage is below 10V.
You should charge the battery in time when the battery is lower than 7.4V.
We added 7 WS2812 RGB LEDs (or the NeoPixel) on the NyBoard. The pin number is D10. They are powered by the 5V DC-DC power chip for Raspberry Pi and are independent of the 5V network of ATMega328P. So you need to plug in the battery to power the LEDs.
We adopted the Grove sockets for convenient plug-and-play connections. There are three types of socket:
Grove Socket
Pin Number
Function
G1
I2C: SCL, SDA
I2C with 3.3V logic signal
G2
A2, A3
Analog input; 0-5V
G3
PD8, PD9
Digital I/O; 0-5V
G4
PD6, PD7
Digital I/O; 0-5V
The main chips are powered by a Low-dropout (LDO) linear regulators for noise removal and better stability. We use LM1117-5V and XC6206P-3.3V to power 5V and 3.3V chips. The 3.3V LDO is connected in serial after the 5V LDO for better efficiency.
There's a diode between the battery and LM1117-5V to prevent damage by the wrong connection. There's a self-recover fuse (6V 500mA) on the USB uploader to limit the current and protect the USB port.
The Raspberry Pi consumes much more power, so we choose TPS565201 DC-DC to provide a 5V 3A output. The peak output can be 5A and with high-temperature/current/voltage protection. It will cut off the power when the chip keeps outputting >4A and over 100 Celcius degrees until the temperature drops to normal. The WS2812 RGB LEDs are also powered by this DC-DC source.
The servos are powered by 2S Li-ion batteries directly. Pay attention not to short connect the power or any pins on the NyBoard.
Last updated: Jan 13, 2021
BiBoard is a robot dog controller based on ESP32 developed by Petoi LLC. Unlike NyBoard for normal users and robot lovers, BiBoard is mainly facing developers and geeks. High-performance processors, larger memory and storage, wireless connections. Audio function is also included.
The function partition for BiBoard is shown below:
Block diagram for BiBoard is shown below:
There're 2 ways to power the BiBoard: USB 5V and battery socket 7.4V.
When using USB power, thereβs no power output for DC-DC 5V extension and servo. So USB power mainly supplies ICs.
When using battery power at 7.4V (maximum: 8.4V). Both servos and 5V power will be supplied. You can use 5V powering the Raspberry Pi.
Open βPreferencesβ in Arduino, add ESP32 development board URL:
https://dl.espressif.com/dl/package_esp32_index.json
Save it and then exit.
Open βBoards Managerβ and wait for updates from external board support links. Search βESP32β and download its board support package.
After shown βINSTALLEDβ, the BiBoard board support package is finished.
Thereβs no USB circuit in the ESP32, so we use the CP2102 USB bridge as officially recommended. The maximum download baud is 921600. The bridge is connected to serial1 of the ESP32.
We use the USB Type-C port, 2 resistors CC1 and CC2 are added as the identifier.
We tried the automatic download circuit designed by ESP and the NodeMCU, but none of them works perfectly. So we modified the circuit by adding the third transistor and enlarger the capacitor.
The transistors receive standard serial modem signals DTR and RTS and trigger a unique timing-sequence forcing ESP32 into download mode and then reboot. The detail of the automatic download circuit is shown below.
We use Invensense MPU6050, the most widely used IMU. Its I2C address is 0x68, and DMPβs interrupt is connected to IO26 of the ESP32.
With the help of Jrowbergβs MPU6050 DMP library, you can easily get the motion status of the Bittle. The Jrowbergβs MPU6050 library must be modified to adapt ESP32. The data types of βint8β and βPGMSpaceβ should be pre-defined instead of 8-bit AVR macros. We offer the modified library of MPU6050. You can replace the original library so that both AVR boards and ESP boards would be worked normally.
There is a 64Kbit EEPROM on the BiBoard. You can directly use the EEPROM read and write a program that is used on the Arduino UNO. You can use it to store calibration data.
There is also an example program named βEEPROMβ in the ESP32 support package. This is not the demo code of the I2C EEPROM. Thatβs the demo of the simulated EEPROM by ESP32βs QSPI flash memory.
We use DAC output and a class-D amplifier instead of a PWM buzzer to make Bittle more vivid. You can use 3 ways to drive the audio module:
Use Arduino βTone()β function.
Use ESP32 βdacWrite()β function like βanalogWrite()β in Arduino. The data quality produced by the DAC is better than the PWM.
Use ESP MP3 decode library developed by XTronical, you can play MP3 files. You should configure a file system like SPIFFS or FAT in the flash before you use this MP3 decoder.
URLοΌhttps://www.xtronical.com/basics/audio/dacs-on-esp32/
The IR sensor on Nyboard and BiBoard are the same, so you can directly use the sketch from the Nyboard. The BiBoardβs flash is large enough so that you donβt have to disable macros in IRremote.h.
Thereβre 12 PWM servo sockets on the BiBoard, and the pin number is marked near the socket.
We transform the direction of the PWM servo socket by 90 degrees since the size of the ESP32 module. You should connect the wires first before you screw the BiBoard on the cage.
Thereβre 3 extension sockets on the BiBoard that marked with P15, P16 and P17.
This socket is used for analog input extension, you can try to connect foot press sensors to this socket.
This socket is used for bus extension of the ESP32.
You can use this interface to connect to the Raspberry Pi, but you cannot directly mount the Raspberry Pi above the BiBoard. Use wires or adapters instead.
πβ‘οΈπ€
ΠΡΠΎ GitBook Ρ Π°Π± Π΄Π»Ρ ΡΠ°Π·ΠΌΠ΅ΡΠ΅Π½ΠΈΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ ΠΏΠΎ Π½Π°ΡΠΈΠΌ ΠΏΡΠΎΠ΄ΡΠΊΡΠ°ΠΌ. ΠΡ ΠΏΠΎΡΡΠΎΡΠ½Π½ΠΎ ΠΎΠ±Π½ΠΎΠ²Π»ΡΠ΅ΠΌ Π½Π°ΡΠΈ ΠΌΠΎΠ΄Π΅Π»ΠΈ ΠΈ ΠΊΠΎΠ΄, ΡΡΠΎΠ±Ρ ΠΏΡΠ΅Π΄ΡΡΠ°Π²ΠΈΡΡ ΠΌΠΈΡΡ Π±ΠΈΠΎΠ½ΠΈΡΠ΅ΡΠΊΠΈΡ ΡΠΎΠ±ΠΎΡΠΎΠ²-ΠΏΠΈΡΠΎΠΌΡΠ΅Π². ΠΠΎΠΆΠ°Π»ΡΠΉΡΡΠ°, Π²Π½ΠΈΠΌΠ°ΡΠ΅Π»ΡΠ½ΠΎ ΠΏΡΠΎΡΡΠΈΡΠ΅ ΠΏΡΠΈΠΌΠ΅ΡΠ°Π½ΠΈΡ ΠΊ Π²Π΅ΡΡΠΈΡΠΌ, ΡΡΠΎΠ±Ρ Π½Π°ΡΡΡΠΎΠΈΡΡ ΡΠ²ΠΎΠ΅Π³ΠΎ ΡΠΎΠ±ΠΎΡΠ°.
ΠΡΠ»ΠΈ Π²Π°ΠΌ Π½ΡΠΆΠ½Π° ΠΏΠΎΠΌΠΎΡΡ, Π½Π°ΠΏΠΈΡΠΈΡΠ΅ Π½Π° support@petoi.com ΠΈΠ»ΠΈ ΠΎΡΡΠ°Π²ΡΡΠ΅ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ Π½Π° Π½Π°ΡΠ΅ΠΌ ΡΠΎΡΡΠΌΠ΅ petoi.camp.
The Bluetooth module is a standard transparent transmission module, which sends serial port data to devices connected to Bluetooth.
Insert the Bluetooth module into the Nyboard downloader socket and open the serial downloader to search for the Bluetooth signal of Bittle-xxxx (random number). The default password for pairing is β1234β or β0000β (for the convenience of connection, the default password for the newer version is set to β0000β). Please enter the password before pairing. After the pairing is successful, the system will assign a serial port number, and you can select the corresponding serial port number on the Arduino.
For Win10 users, the system will assign the "incoming" COM port and the "outgoing" COM port to Bluetooth, please use the "outgoing" COM port. For details, please check in the "Bluetooth Settings" of Win10.
If you want to use the BLE connection, please scan and connect to BittleBLE-xxxx (random number), and you can use the Lightblue or other tools to communicate with the Bittle.
If you want to configure the Bluetooth module, please refer to "JDY-23 AT Command List". Plug the Bluetooth module into the USB communication module debugging interface. The commonly used commands are listed below:
Usage
Command
Demo
Check BT module version
AT+VER
AT+VER
>+VER=JDY-23A-V2.21,Bluetooth V3.0+BLE
οΌBT module version infomationοΌ
Check BT broadcast name
AT+NAME
AT+NAME
>+NAME=BITTLE
Change BT broadcast name
AT+NAME(εε)
AT+NAMEPiggy
>+OK
AT+NAME
>+NAME=Piggy
Check serial baud rate
AT+BAUD
AT+BAUD
>+BAUD=8 οΌ8 = 115200οΌ 7=57600οΌ
Change serial baud rate
AT+BAUD
AT+BAUD7
>+OK οΌSet serial monitor to 57600οΌ
AT+BAUD
>+BAUD=7
When you use serial terminal like "Arduino serial monitor" to set JDY-23 with AT commands, you must set "NL and CR", or JDY-23 module will not identify any AT command you send.
This module uses ESP8266EX's official model ESP-WROOM-02D, 4MB QSPI Flash. The module is certified by FCC in the United States, CE-RED in Europe, TELEC in Japan, and KC in South Korea.
The module is fully opened, you can program it separately. This is not a simple transparent transmission module.
The module includes an automatic download circuit and a communication module. The automatic download circuit refers to the official recommendation to use 2 S8050 transistors to receive the RTS and DTR signals from the CH340C downloader and trigger the download sequence.
Connect to the NyBoardοΌ
Update sketches through USB downloaderοΌ
We use the Arduino as the development environment.
URLοΌhttp://arduino.esp8266.com/stable/package_esp8266com_index.json. Paste it into the URL of the additional development board in the Arduino preferences.
Then open the "Board Manager" and enter ESP8266 or 8266 to search for the board support package:
Download the package ESP8266 by ESP8266 Community.
After the board support package downloaded, we select ESP8266 Board (current version: 2.74) -> Generic ESP8266 Module.
Then we set the parametersοΌ
Parameters
Settings
Builtin Led
2
Upload Speed
921600οΌAuto-negotiation during downloading, 115200 is too slowοΌ
CPU Frequency
160MHz
Flash Size
4MB
Reset Method
DTR reset
lwIP variant
V2 Lower memory
Erase Flash
Only sketch
After configuration, we use the Arduino classic "Blink" program to test the ESP8266 development board.
Open the Blink project, configure the development board, plug the module into the communication module debugging interface of the USB downloader, and download the Blink example.
Compared with the Arduino UNO, the compilation time is slightly longer, after Linking, the download progress will be displayed as a percentage:
The "Blink sketch" uses 257KB of flash and 26.8KB of the SRAM.
Project URLοΌhttps://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/ESP8266WiFiController
There're 3 files in the project:
ESP8266WiFiController.ino: Arduino sketch with server core code.
mainpage.hοΌwelcome page (html) in a char array.
actionpage.hοΌaction controller page (html) in a char array.
Please put them in the folder named "ESP8266WiFiController", then open the ino file and download it to the ESP8266 WiFi module.
After the sketch downloader to the WiFi module, we strongly recommend run it with your USB downloader so you can get the serial output in the Arduino serial monitor.
Open your smartphone WiFi scanner and find an access point named "Bittle-AP" that is not encrypted. Connect it.
If your smartphone automatically optimizes your network connection, it will cut the connection of "Bittle-AP" because there is no Internet connection. Your smartphone may connect to the WiFi with an Internet connection or even use your cellular data.
Your smartphone may auto jump to the "WiFiManager" page when connecting to "Bittle-AP".
If not, please open your browser and enter 192.168.4.1 to enter the WiFi connection configuration page manually.
On the WiFiManager page, Bittle's wireless module will automatically search for all nearby WiFi SSIDs and display them. After you click on your own WiFi SSID and enter the password, Bittle will connect to this network first.
Bittle will print out the IP address assigned by DHCP through the serial port after connecting to the WiFi successfully. You can also configure a fixed IP address in Arduino.
Enter the IP address of the WiFi module, now you can control the Bittle through WiFi!
The sample code is a simple web server example, including 2 HTML pages. The two pages are stored in two header files in the form of string constants. The advantage is to avoid calling the client.print function constantly.
Before we start our web server, we should configure the WiFi to connect to your local area network(LAN). We used to enter the WiFi SSID and password in the program, but it is very inconvenient while we need to change the network environment.
We use the WiFi manager library to configure the WiFi information through web.
Create a new web server and configure port 80 (commonly used HTTP server port)
The HTTP response function is to handle the incoming HTTP requests.
The handleMainPage and handleActionPage response 200 (OK) and corresponding web HTML code for your web browser (client).
The HandleAction function is slightly different. This is an HTTP request processing function with parameter passing. When the parameter is "gyro", the serial port of the WiFi module sends out the command ("g", switch IMU), so that our Bittle will execute the command.
So how is this "gyro" parameter generated and passed? Because we sent such an HTTP request with a value to the server:
The server parses the action parameter by the function and resolves that the name is "gyro".
We can directly enter this URL in the browser and execute it with the keyboard. The more common method is to add a link to the "Walk" button on the ActionPage web page. When the gyro button is pressed, the above URL will be sent to the host.
The complete walk button configuration is as follows:
After parsing the "name" parameter, we send the actionpage again.
We bond the handler method with the corresponding URLs.
Compared to the ATMega328P on the NyBoard, thereβre more hardware and software resources on the ESP8266, you can do more experiments with it.
Connect your Bittle to IoT platforms with HTTP restful APIs.
MQTT and node-red.
OTA with WiFi.
Make ESP8266 a strong co-processor for NyBoard for motion data fusion.