Today let’s take a look at Ardupy. We know you probably have questions about when you first browsed the product page for Wio Terminal, it said Wio Terminal supports Arduino, Micropython, ArduPy, AT Firmware, Visual Studio Code. Let’s help you figure out:
- What is Ardupy?
- Easily get started with it using Visual Studio Code IDE.
You will find out how programming gets easier with Ardupy!
What is Ardupy?
You must have heard of Arduino, an open-source prototyping platform based on easy-to-use hardware and software. Arduino makes rapid development possible for people who are interested in creating interactive objects or environments, no matter they are artists, designers or hobbyists.
But have you ever imagined that if we can make it more efficient and convenient?
Here we bring you ArduPy, a combination of Arduino and MicroPython developed by Seeed. With the help of the ArduPy aip package manager we provided, you can transform your favorite Arduino library into a MicroPython library with ease.
Through ArduPy, you can use Python to verify your ideas, learn python programming as well as micro-controller programming in a more efficient way.
Why choose ArduPy?
- ArduPy can experience complete python 3 on embedded devices with limited resources
- Compatible with Visual Studio Code, easy installation & easy configuration
- Support for simple file systems
- Support for automatic running of boot.py when reset
- Support serial terminal interaction
- Rich third party library
Get Started with ArduPy: How to Install and Use ArduPy IDE
Step 1. Install Python 3
Python 3 is required for the ArduPy, so please download and install Python 3 into your environment before the following.
Step 2. Install the Aip package manager
Aip is a package manager for converting Arduino Libraries into Python interfaces, which is essential for ArduPy.
Use pip to install the
ardupy-aip. Run the following command:
pip3 install ardupy-aip
Note: For Windows user, use Powershell. For Linux or Mac OS users, use Terminal.
Once the dependencies are installed, you can run
aip in all directory to see help and check if errors appeared.
Step 3. Install the ArduPy IDE
To use ArduPy, we need to use another IDE other than Arduino IDE to compile (and upload) the MicroPython code into our device.
- Download and install the Visual Studio Code IDE according to your OS.
- Open the Extensions Market in VS Code by clicking the Extensions on the left panel or use the keyboard shortcut:
Shift+CTRL+Xin Windows or
Shift+CMD+Xin Mac Os.
- Search Seeed ArduPy IDE in the Extension Market.
- Click Install to install the IDE plug-in.
- Once installed the Seeed ArduPy IDE plug-in in VS code, you can start playing with MicroPython!
Step 4. Connecting with the Device
- Connect the device to your PC via a USB cable. Here we use Wio Terminal as a sample.
- On the Bottom of the VS Code IDE, you should be able to see a Device Connection (Plug Symbol). Click the Device Connection symbol, a window will appear with all the available serial connections.
- Click on the right serial connection(Your Device) to connect.
- Mac Os:
- Once connected, a window will appear in the bottom and check if the ArduPy firmware is already loaded into the device.
Choose Yes and it will download and load the latest ArduPy firmware onto the device and you can start programming your device in Python Syntax!
Once connected, the device name should appear at the bottom of the IDE and you can use the features to start programming with ArduPy.
Features(Left to Right):
- Create a MicroPython Project
- Open the MicroPython Terminal
- Run the MicroPython Project
Q: How to add files?
A: To add files to the device using ArduPy, simply click the icon as shown above to choose files from your PC.
Q: How to Boot Script?
A: To run a MicroPython script from boot up, simply name your project
boot.py and load the files in the device as the methods mentioned above.
Using aip to include Other ArduPy Libraries(From Arduino Libraries)
Aip is one of the key features of ArduPy, which can be used to convert Arduino Libraries to Python Interface to be used for ArduPy. Here we provide an example and introduce how to include the ArduPy library into ArduPy Firmware.
We provide few ArduPy library examples on the GitHub page for now, and soon will release tutorials on how to convert Arduino libraries to ArduPy Libraries very soon.
Step 1.install specific ArduPy library
Open Terminal/Powershell, and use the following code to install specific ArduPy library:
aip install Seeed-Studio/seeed-ardupy-ultrasonic-sensor
Step 2. Build the firmware
Use the following code to build the firmware:
Note: Usage of flashing firmware will appeared at the bottom of build.
Step 3. Flash the “NEW” firmware into the board
Flash the “NEW” firmware into the board by copying the usage from end of build. Here aip will automatically look for the board connected to the PC and upload the firmware. If board is not connected, an error will appear.
aip flash # + ArduPy Bin PATH
You can also use
aip build clean before
aip build to remove any caches from before to avoid error.
Once the library is included within the ArduPy firmware and flashed into the device, you can import and use the module as follow:
from arduino import grove_ultra_ranger import time ur = grove_ultra_ranger(0) while True: print ("The distance to obstacles in front is:", ur.cm, 'centimeter') time.sleep(1)
By default, the ArduPy initial firmware only includes time, Pin, DAC, ADC, PWM, and LCD. Check more detailed information at our Wiki!
Explore More about ArduPy at our Github and Forum
ArduPy Core is Pyboard-friendly and supports basic hardware operations on the board. We wish to develop the ArduPy into a community-driven software and look forward to your participation. Check our Wiki and Github for more technical details and join the discussion at our Forum!
ArduPy works perfectly with Wio Terminal, allowing you to build I/O with the physical world in a more pythonic way. Wio Terminal It is an ATSAMD51-based Dev. board with wireless connectivity supported by Realtek RTL8720DN. Let’s have a look!
A Brief Introduction of Wio Terminal
If you have any questions about Wio Terminal, feel free to post your question at our forum. Stay tuned with us and get updates of ArduPy and Wio Terminal!