Skip to content

Commit 53452f5

Browse files
Added information on STM cube
1 parent 5867af8 commit 53452f5

File tree

5 files changed

+62
-41
lines changed

5 files changed

+62
-41
lines changed

content/hardware/08.edu/solution-and-kits/alvik/tutorials/getting-started-C/getting-started-C.md

Lines changed: 62 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
---
2+
title: "Getting Started with Alvik"
3+
difficulty: beginner
4+
description: "Take your first steps with Arduino® Alvik on Arduino IDE"
5+
tags:
6+
- Robot, MicroPython, Education
7+
author: "Pedro Sousa Lima"
8+
---
9+
110
# Getting Started with Alvik on Arduino IDE
211

12+
The Arduino® Alvik robot was designed to be compatible with both C++ and MicroPython. To ensure a smooth experience, functions have the same structure and parameters across all environments. This means the [Alvik's API reference](https://docs.arduino.cc/tutorials/alvik/api-overview/) can be used as a resource regardless of which environment you choose. In this guide, we will prepare the board to be programmed using the Arduino IDE.
13+
314
## Requirements
415

516
### Software
617

7-
- **Arduino IDE**: The primary development environment for writing, compiling, and uploading code to Alvik.
8-
- **Alvik Library for Arduino**: A library that provides easy access to the Alvik robot's functionalities.
18+
- **Arduino IDE**: A modern desktop-based [Arduino IDE](https://support.arduino.cc/hc/en-us/articles/360019833020-Download-and-install-Arduino-IDE).
19+
- **Alvik Library for Arduino**: A [library](https://github.com/arduino-libraries/Arduino_Alvik) that provides easy access to the Alvik robot's functionalities.
920
- **USB Drivers**: Ensure you have the correct drivers installed to communicate with Alvik via USB.
21+
- **STM32Cube**: You will need this 3rd party programmer tool by ST available [here](https://www.st.com/en/development-tools/stm32cubeprog.html) to program the STM board.
1022

1123
### Hardware
1224

@@ -29,49 +41,58 @@
2941

3042
1. Connect pin **B1** to **GND** on the Alvik board.
3143
![B1 and GND pins](assets/nano-esp32-gnd-b1.png)
32-
2. Connect the Alvik board to your computer using the USB cable.
33-
3. Open the **Blink** example in the Arduino IDE by going to **File > Examples > 01.Basics > Blink**.
34-
![alt text](assets/blinkExample.png)
35-
4. Select **esptool** as the programmer from the **Tools > Programmer** menu.
36-
![alt text](assets/EsptoolSelection.png)
37-
5. Select **Upload Using Programmer** from the **Sketch** menu.
38-
![alt text](assets/UploadWithProgrammer.png)
39-
6. Your board should now be restored and ready for programming with the Arduino IDE.
40-
41-
#### Preparing Alvik for MicroPython
42-
43-
1. Install the micropython bootloader on it following [this guide](https://docs.arduino.cc/micropython/basics/board-installation/).
44-
45-
2. Download the Alvik micropyton libraries
46-
Alvik micropython libraries from the [Alvik repository](https://github.com/arduino/arduino-alvik-mpy/tree/main)
47-
ucPack libraries from the [ucPack repository](https://github.com/arduino/ucPack-mpy/tree/main)
48-
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
49-
![Setting the FW path on the Labs for micropython](assets/fw_path.png)
50-
4. Make sure your Alvik is OFF, connect it to your computer and then, turn it ON
51-
![Alvik USB Connection](assets/connecting-final.gif)
52-
5. Connect your Alvik to the Arduino Labs for micropython and open the "lib"
53-
![Setting the FW path on the Labs for micropython](assets/lib_folder.png)
54-
6. Select the "Arduino-alvik" and move it inside the "lib" folder in your Alvik.
55-
![Setting the FW path on the Labs for micropython](assets/moving_alvik_folder.png)
56-
7. Go back to the main folder and select the "ucPack-mpy-main" folder and move it next to the arduino_alvik inside the "lib" folder in your Nano ESP32.
57-
![Setting the FW path on the Labs for micropython](assets/moving_ucPack.png)
58-
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.
59-
`demo.py`
60-
`hand_follower.py`
61-
`line_follower.py`
62-
`main.py`
63-
`touch_move.py`
64-
65-
![Setting the FW path on the Labs for micropython](assets/moving_examples.png)
66-
With this last step, your Nano ESP32 has been set up with the Alvik out of the box experience and is ready to be used.
44+
3. While both pins are connected plug the Alvik board to your computer using the USB cable.
45+
5. Select **esptool** as the programmer from the **Tools > Programmer** menu.
46+
![Select programming tool esptool](assets/EsptoolSelection.png)
47+
6. Select **Upload Using Programmer** from the **Sketch** menu.
48+
![Upload with programmer option](assets/UploadWithProgrammer.png). You can nowpPress the **Reset** button on the board to make sure it is ready for uploading.
49+
1. Open the **Bridge** example in the Arduino IDE by going to **File > Examples > 01.Basics > Blink**.
50+
![Bridge Firmware Updater](assets/bridgeFirmware.png)
51+
1. Open **STM32 Cube Programmer**
52+
2. Set the connection to **UART** mode, the **Port** to whatever port the board is connected to and **DTR** to HIGH. You can now press **Connect**.
53+
![Settings for STMCube](assets/stmCubeSetup.png)
54+
3. Go to **Erasing & Programming** mode and edit the **File path** to the firmware (this will be a .bin file) you are trying to program. You can find the latest release [here](https://github.com/arduino-libraries/Arduino_Alvik/releases/tag/1.0.1). You can now press **Start Programming**.
55+
![Programming STM Cube](assets/ProgrammingstmCube.png)
56+
57+
58+
1. After the firmware is programmed your board should now be ready!
6759

6860

61+
62+
You can at any point revert back to the MicroPython programming eviroment by following the content available over at the [MicroPython installation guide](https://docs.arduino.cc/micropython/micropython-course/course/installation/).
63+
6964
## Programming Alvik
7065

71-
1. Start with a simple example, like blinking an LED or reading a sensor.
72-
2. Use the Alvik library functions to interact with the robot's hardware.
73-
3. Upload your sketch to see it in action.
74-
4. Explore the included examples in the Alvik library to learn how to control motors, read sensors, and more.
66+
Let's confirm our firmware is correctly installed. For this we will create a simple sketch that prints the firmware version using the ```get_version()``` function:
67+
68+
```C
69+
#include "Arduino_Alvik.h"
70+
71+
Arduino_Alvik alvik;
72+
73+
void setup() {
74+
alvik.begin();
75+
Serial.begin(115200);
76+
}
77+
78+
void loop() {
79+
80+
uint8_t u,m,l;
81+
82+
alvik.get_version(u,m,l); // Gets the firmware version
83+
Serial.printf("%d.%d.%d\n", u, m, l);
84+
alvik.drive(10, 45);
85+
delay(1000); // Waits a second
86+
alvik.drive(10, -45);
87+
delay(1000); // Waits a second
88+
89+
}
90+
```
91+
92+
After upload the Alvik should rotate the wheels and print the version once per second.
93+
94+
You can now explore the other included examples that cover more of the Alvik's components.
95+
7596

7697
## More Resources (C++)
7798

Loading

0 commit comments

Comments
 (0)