Skip to content

Commit 65c1285

Browse files
Merge branch 'Pedromsousalima/Alvik/UMFixes' of https://github.com/arduino/docs-content into Pedromsousalima/Alvik/UMFixes
2 parents 9149d3c + 2a50208 commit 65c1285

File tree

8 files changed

+65
-29
lines changed

8 files changed

+65
-29
lines changed
Loading
Loading

content/hardware/08.edu/solution-and-kits/alvik/tutorials/user-manual/user-manual.md

+37-29
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ author: "Paolo Cavagnolo, Pedro Miguel, Jose Garcia"
1111
## Introduction
1212
Arduino® Alvik is a powerful and versatile robot specifically designed for programming and STEAM education.
1313

14-
![Alvik's Robot](assets/alvik_main.jpg)
14+
![Alvik's Robot](assets/alvik_main.gif)
1515

1616
Powered by the Arduino® Nano ESP32, Alvik offers diverse learning paths through different programming languages including MicroPython, Arduino C, and block-based coding; enabling different possibilities to explore Robotics, IoT, and Artificial Intelligence.
1717

@@ -36,7 +36,7 @@ Inside the Arduino Alvik package you'll find the following items:
3636

3737
![Alvik exploded view](assets/main-components.png)
3838

39-
***When the PCB is out of the chassis and the battery is in place there is the risk of short-circuiting the 18650 Li-Ion battery. If you remove the hardware from the chassis make sure you do it on a __non-conductive surface clean__ of materials or tools that can short-circuit the battery***
39+
***When the PCB is out of the chassis and the battery is in place there is the risk of short-circuiting the 18650 Li-Ion battery. If you remove the hardware from the chassis make sure you do it on a __non-conductive surface clean__ of materials or tools that can short-circuit the battery.***
4040

4141
### Main Components
4242

@@ -46,7 +46,7 @@ Inside the Arduino Alvik package you'll find the following items:
4646

4747
## Alvik's Brain
4848

49-
The brain of the Alvik robot is the Nano ESP32, which is the central component we program to run the logic and make decisions. It is extremely important because it processes all the high-level commands and controls the overall operation of the robot. However, instead of directly moving the motors or reading sensors, it communicates with the STM32 (the body) to execute these actions. The Nano ESP32 gives orders to the STM32 to move, read sensors, or report status, allowing the robot to make informed (or better yet, as informed as we program it) decisions and run tasks and routines using this information.
49+
The **Nano ESP32** is the brain of the Alvik robot, acting as the central hub that runs the logic and makes key decisions. While it plays a critical role in processing high-level commands and overseeing the robot's operations, it doesn't directly control the motors or sensors. Instead, the Nano ESP32 communicates with the **STM32** (the body), sending instructions for actions like movement, sensor readings, or status updates. This collaboration allows the robot to perform tasks and routines based on the data it receives, enabling it to make informed decisions as we've programmed it to be.
5050
![Alvik Brain](assets/alvik_brain.png)
5151

5252

@@ -74,7 +74,7 @@ The main core of the robot is the STM32 ARM Cortex-M4 32 Bit controller. It hand
7474

7575
You can learn more about the available functions for Alvik in the following [Alvik's API Documentation](https://docs.arduino.cc/tutorials/alvik/api-overview).
7676

77-
***Although Alvik's "out of the box" experience is designed in micropython, there are C++ APIs that allow you to program Avlik in the Arduino IDE, these APIs are 1 to 1 compatible with the micropython APIs, which means that the [Alvik's API Documentation](https://docs.arduino.cc/tutorials/alvik/api-overview) will give you information for both micropython and C++ programming experiences.***
77+
***Although Alvik's "out of the box" experience is designed in MicroPython, there are C++ APIs that allow you to program Avlik in the Arduino IDE, these APIs are 1 to 1 compatible with the MicroPython APIs, which means that the [Alvik's API Documentation](https://docs.arduino.cc/tutorials/alvik/api-overview) will give you information for both MicroPython and C++ programming experiences.***
7878

7979

8080
The latest firmware of the STM32 can be found at [this link](https://github.com/arduino-libraries/Arduino_AlvikCarrier/releases), and [here](#how-to-upload-firmware) is the guide to flash it.
@@ -93,7 +93,7 @@ Because of the need to communicate with the STM board, some of the pins of the A
9393
- **Power Connector**
9494

9595
This connector allows you to get power from the Alvik's power system as well as get the power status. It also provides mechanical support for your designs. Here you can identify the connectors that can be used. Note that the remaining pins are not in use but can serve for mechanical support.
96-
![alt text](assets/Alvik_Docs_Pinout_Callout.jpg)
96+
![Power Connectors on Nano ESP32](assets/Alvik_Docs_Pinout_Callout.jpg)
9797

9898
### ON/OFF Switch
9999

@@ -131,16 +131,26 @@ The battery is located in the bottom part of Alvik, if you need to access it you
131131

132132
![Accessing battery compartment](assets/battery_holder.jpg)
133133

134-
1. **Detach the Existing Battery**: Carefully remove the old battery from its compartment.
135-
2. **Attach a New Battery**: Place the new battery into the holder, ensuring it is securely connected.
136-
3. **Plug in the Nano ESP32**: If you are using a different controller or have used the robot in another manner, reconnect the Nano ESP32.
137-
4. **Connect the Nano ESP32 to the Computer**: Use a USB cable to connect the Nano ESP32 to your computer.
134+
Follow the steps below to replace Alvik's battery and reset the battery management system (BMS):
138135

139-
These steps are crucial for resetting the Battery Management System (BMS) after a battery replacement. If these steps are not followed, the BMS will remain "off," and the robot will not turn on.
136+
1. **Turn Alvik OFF**.
137+
2. **Unplug Arduino Nano ESP32** board from the Alvik's body.
138+
3. **Re-install Arduino Nano ESP32’s MicroPython bootloader** by following [**this guide**](https://docs.arduino.cc/micropython/basics/board-installation/).
139+
4. **Remove the existing battery**: carefully take the old battery out of its compartment.
140+
5. **Tighten the battery holder terminals** pull the + and – terminals slightly toward the center to ensure they make good contact with the battery terminals.
141+
6. **Insert the new battery**: place the new battery into the holder, ensuring it is securely connected. To confirm proper contact, use a multimeter (set to 20V) to measure the battery holder terminals (+ & -); it should show the battery's voltage.
142+
7. **Reconnect the Nano ESP32**: If you are using a different controller or have used the robot in another manner, reconnect the Nano ESP32.
143+
8. **Connect the Nano ESP32 to your computer** using the USB cable, while the Alvik switch is in OFF position.
144+
9. **Once the battery begins charging**, switch ON Alvik, like the image below.
145+
146+
![Charging blink](assets/charging.gif)
147+
148+
149+
***Note: When Alvik is switched back ON, the charging LED indicator goes OFF.***
140150

141151
## Alvik's Sensors
142152

143-
Alvik includes a set of different sensors listed below, all connected to the STM32 and accessible through the [APIs](https://docs.arduino.cc/tutorials/alvik/api-overview). For each sensor there is test example program that you can find in the _examples_ folder in [this repository](https://github.com/arduino/arduino-alvik-mpy/tree/main/examples) for micropython and in [this repository](https://github.com/arduino-libraries/Arduino_AlvikCarrier/tree/main/examples) for C++.
153+
Alvik includes a set of different sensors listed below, all connected to the STM32 and accessible through the [APIs](https://docs.arduino.cc/tutorials/alvik/api-overview). For each sensor there is test example program that you can find in the _examples_ folder in [this repository](https://github.com/arduino/arduino-alvik-mpy/tree/main/examples) for MicroPython and in [this repository](https://github.com/arduino-libraries/Arduino_AlvikCarrier/tree/main/examples) for C++.
144154

145155

146156
| **Sensor name** | **Part name** | **Test program name** |
@@ -163,10 +173,10 @@ The Arduino Alvik robot is equipped with seven capacitive touch buttons. These b
163173
- Left
164174
- Right
165175
- Center
166-
- OK (represented by a "tick" Icon)
167-
- Cancel (represented by a "x")
176+
- OK (represented by a "``" icon)
177+
- Cancel (represented by a "`x`")
168178

169-
![Touch Button position](assets/touchButton.png)
179+
![Touch Button position](assets/touchButtons.png)
170180

171181
Each button can be programmed to perform specific actions, providing more complex interface for user interaction.
172182

@@ -281,28 +291,27 @@ To get started to play with Alvik you will need the following hardware and softw
281291

282292
It may happen that you used your Nano ESP32 for other projects than Alvik, or you need to replace it. In order to make your Nano ESP32 work with Alvik, there are few steps needed:
283293

284-
1. Install the micropython bootloader on it following [this guide](https://docs.arduino.cc/micropython/basics/board-installation/).
294+
1. Install the MicroPython bootloader on it following [this guide](https://docs.arduino.cc/micropython/basics/board-installation/).
285295

286-
2. Download the Alvik micropyton libraries
287-
Alvik micropython libraries from the [Alvik repository](https://github.com/arduino/arduino-alvik-mpy/tree/main)
296+
2. Download the Alvik Micropython libraries Alvik MicroPython libraries from the [Alvik repository](https://github.com/arduino/arduino-alvik-mpy/tree/main)
288297
ucPack libraries from the [ucPack repository](https://github.com/arduino/ucPack-mpy/tree/main)
289298

290299

291-
3. Unzip both of the downloaded libraries in a single "Alvik" folder, open the Arduino Lab for MicroPython, go to the "files" tab and set the path to the unzipped folder on the Arduino Lab for Micropython
300+
3. Unzip both the downloaded libraries in a single "Alvik" folder, open the Arduino Lab for MicroPython, go to the "files" tab and set the path to the unzipped folder on the Arduino Lab for MicroPython.
292301

293302
![Setting the FW path on the Labs for micropython](assets/fw_path.png)
294303

295-
4. Make sure your Alvik is OFF, connect it to your computer and then, turn it ON
304+
4. Make sure your Alvik is OFF, connect it to your computer and then, turn it ON:
296305

297306
![Alvik USB Connection](assets/connecting-final.gif)
298307

299-
5. Connect your Alvik to the Arduino Labs for micropython and open the "lib"
308+
5. Connect your Alvik to the Arduino Labs for MicroPython and open the "lib".
300309
![Setting the FW path on the Labs for micropython](assets/lib_folder.png)
301310

302311
6. Select the "Arduino-alvik" and move it inside the "lib" folder in your Alvik.
303312
![Setting the FW path on the Labs for micropython](assets/moving_alvik_folder.png)
304313

305-
7. Go back to the main folder and select the "ucPack" folder found inside "ucPack-mpy-main" and move it next to the arduino_alvik inside the "lib" folder in your Nano ESP32.
314+
7. Go back to the main folder and select the "ucPack" folder found inside "ucPack-mpy-main" and move it next to the *arduino_alvik* inside the "lib" folder in your Nano ESP32.
306315
![Setting the FW path on the Labs for micropython](assets/moving_ucPack.png)
307316

308317
8. Now go back to the main root of the files system on the Nano ESP32. Then in your local folder navigate to the examples folder once there, select the following files and move them to the main folder of the ESP32.
@@ -321,15 +330,15 @@ With this last step, your Nano ESP32 has been set up with the Alvik out of the b
321330

322331
1. Download the [pre-compiled firmware](https://github.com/arduino-libraries/Arduino_AlvikCarrier/releases/latest) from the [Alvik Carrier GitHub repository](https://github.com/arduino-libraries/Arduino_AlvikCarrier)
323332

324-
This step will download a "firmware_x_x_x.bin" file, save it in your Alvik folder
333+
This step will download a "firmware_x_x_x.bin" file, save it in your Alvik folder.
325334

326-
2. Connect your Alvik to the Computer and to the Arduino Labs for Micropython. Then, go to the files tab and navigate to the folder where you stored the "firmware_x_x_x.bin"
335+
2. Connect your Alvik to the Computer and to the Arduino Labs for MicroPython. Then, go to the files tab and navigate to the folder where you stored the "firmware_x_x_x.bin".
327336
![Setting the FW path on the Labs for micropython](assets/fw_path.png)
328337

329-
3. Let's move now the "firmware_x_x_x.bin" to the main root.
338+
3. Let's move now the `firmware_x_x_x.bin` to the main root.
330339
![Setting the FW path on the Labs for micropython](assets/moving_fw_bin.png)
331340

332-
4. Turn ON your alvik, go to the Editor tab and run the following commands by typing them and clicking on the "Play" button
341+
4. Turn ON your alvik, go to the Editor tab and run the following commands by typing them and clicking on the "Play" button:
333342

334343
```
335344
from arduino_alvik import update_firmware
@@ -347,12 +356,11 @@ Alvik is intended to be programmed with MicroPyton. We recommend you to install
347356

348357
Now that all the previous steps have been set, let's see how to create custom programs for Alvik to move forward until detecting an object in front of it, Alvik will detect it, dodge it and continue on its way.
349358

350-
351-
**1. **Create an Alvik folder in your computer and set it as the path of the Arduino Lab for MicroPython IDE
359+
**1. **Create an Alvik folder in your computer and set it as the path of the Arduino Lab for MicroPython IDE.
352360

353361
![Adding Alvik folder path to the IDE](assets/alvik_folder_path.png)
354362

355-
**2. **Create a new file "obstacle_avoider.py" in your local folder
363+
**2. **Create a new file `obstacle_avoider.py` in your local folder.
356364

357365
![Creating obstacle_avoider.py file](assets/creating_file.png)
358366

@@ -411,7 +419,7 @@ while (True):
411419

412420
![Connecting Alvik to the IDE](assets/connecting_alvik_ide.gif)
413421

414-
***If you want to go back to the out of the box experience where you could select between reg, green and blue programs, you only need to modify the _main.py_ again replacing the `import obstacle_avoider` statement by `import demo`***
422+
***If you want to go back to the out of the box experience where you could select between reg, green and blue programs, you only need to modify the _main.py_ again replacing the `import obstacle_avoider` statement by `import demo`***.
415423

416424
**6. **The last step is to move the _obstacle_avoider.py_ file from the local repository to Alvik's memory.
417425

content/micropython/01.basics/05.digital-analog-pins/digital-analog-pins.md

+28
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,31 @@ pwm.freq(1000)
134134
while True:
135135
pwm.duty_u16(duty)
136136
```
137+
138+
### PWM on GIGA (STM32)
139+
140+
On STM32 boards like the GIGA R1, the PWM setup is slightly different. You need to use the `Timer` module along with the `Pin` module to configure PWM.
141+
142+
Here's how you can set up PWM on STM32 boards:
143+
144+
```python
145+
from machine import Pin, Timer
146+
147+
pin1 = Pin("PC6", Pin.OUT_PP, Pin.PULL_NONE)
148+
timer1 = Timer(3, freq=1000)
149+
channel1 = timer1.channel(1, Timer.PWM, pin=pin1, pulse_width=0)
150+
151+
duty = 50 # Duty cycle percentage (0-100)
152+
153+
while True:
154+
channel1.pulse_width_percent(duty)
155+
```
156+
157+
In this example:
158+
159+
- `pin1` is configured as an output pin with no pull-up or pull-down resistors.
160+
- `timer1` is initialized with a frequency of 1000 Hz.
161+
- `channel1` is created on timer 3, channel 1, and is set to PWM mode.
162+
- `channel1.pulse_width_percent(duty)` sets the duty cycle of the PWM
163+
164+
***Note: Always refer to your board's documentation for the correct pin names and timer configurations specific to the GIGA. For more information, check out the [GIGA R1 MicroPython Guide](https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-micropython/).***

0 commit comments

Comments
 (0)