Overview
Proteus is unique in offering the ability to design, simulate and debug your Arduino turtle programs in software. In Visual Designer you can select either the simple Funduino or the more complex Zumo robot from the peripheral gallery and then use the high level methods listed in the project tree to design your flowchart program.
You can easily create an environment for the turtle robot to simulate inside using MS Paint or an equivalent graphics package. You can draw lines for the robot to follow, obstacles for the robot to avoid or maze puzzles to test your algorithms. It is so fast and easy to change the 'landscape' that programs can be tested against progressively more extreme environments (e.g. right angles, figure of eight, dead ends) with a few clicks of the mouse.
When you have written your program and created your environment you simply press play to run the simulation. Your virtual turtle will appear inside the virtual environment you created and execute your program.
You can pause and single step your code, watching the turtle move under debug control. You can set breakpoints, examine variables and even attach instrumentation to the wires on the schematic.
Since this is a full electrical simulation of the Arduino turtle you can program the real hardware turtle at the press of a button when you are finished testing in software.
- Detailed electrical simulation models for popular robot turtles.
- High level control methods and flowchart programming simplify firmware development.
- Fast and flexible creation of 'virtual worlds' for turtle simulation.
- World class simulation and debugging tools let you test and improve your algorithms in software.
Supported Turtles
There are currently two supported Arduino robot turtles in Proteus, the Funduino and the Zumo.
The Funduino robot includes an ultrasonic distance measuring module mounted on a rotatable head, making it well suited to obstacle avoidance problems. There are three line hunting sensors underneath the chassis and a motor driver board to control the wheels and the stepper motor on the robot head. There is however no position encoders of any kind; the system is entirely open loop, making precise positioning and turning of the robot quite challenging.
The Zumo is a more advanced robot, running on tracks driven from 2 brushed DC gearmotors and including six IR reflectance sensors for line following / edge detection. It also includes a piezo sounder and 3-axis gyroscope and compass, enabling the absolute orientation of the robot via LOGO type functions in Visual Designer (e.g. turnEast()). The Zumo does not include optical rangefinders.
Flowchart Programming
Visual Designer presents a unique way to program Funduino and Zumo robot turtles. Not only can the program be constructed as an easy to understand flowchart but Visual Designer will provide access methods to simplify the control of the turtles.
These high level methods abstract detailed electronics such as the setup of the PWM duty cycle, allowing users to focus on moving and controlling the turtle. Using a flowchart makes it very natural for beginners to create programs and provides a very intuitive way of extending program logic to solve increasingly tricky problems.
The flowchart can be converted into an Arduino C++ project at any time and more advanced users may choose to code directly in C++. A Proteus simulation executes the same HEX file as the hardware CPU and models the real electronics so accurately that students can program in whatever form best suits their skills; from high level flowchart method calls all the way down to the AVR instruction set.
Virtual Playground
The obstacle map, or virtual environment, is a very simple picture that you create in a drawing package such as MS Paint and which is then used by the turtle during simulation. When you start a simulation the picture is launched in a popup window and the virtual turtle appears inside the picture. You can pick up the turtle and position it with the left mouse button if need be (for example to place it on a line) and the turtle will execute your program inside the virtual world.
This makes it very easy (and fast!) to create various problems to test your turtle controller program. Line following, obstacle avoidance and maze solving in various combinations and difficulty levels are amongst the most common obstacle maps.
It's important to draw the picture to scale. For example, a 20 pixel black line is considered 2cm thick or approximately the size of typical electrical tape. Varying the thickness of the line is an excellent way to confuse the turtle program as it will change when the line following sensors are over the line.
- 1 pixel in the PNG file is 1mm in the real world.
- Turtles will try to follow any black line.
- Turtles will see anything in red as an obstacle.
- The simulation will pause if the turtle touches anything green.
Line Following
Line following challenges are perhaps the most popular of all and can vary in complexity from the simple to the surprisingly tricky. The basic idea is that the turtle is placed on (or needs to hunt for) the line and then has to follow the line around the route.
In Proteus, the line is drawn in a Virtual Playground at suitable size in a graphics package and the turtle can then be placed on the line during simulation. The thickness of the line you choose depends largely on your choice of turtle as the Zumo has more line sensors than the Funduino and the spacing between them is different.
Various courses of increasing difficulty can then be quickly drawn to test the flexibility of the turtle program. If bugs or unexpected behaviour are found then Proteus also provides extensive debugging facilities including breakpoints, single stepping and variable display at both Flowchart and Arduino C++ level.
Obstacle Avoidance
With an obstacle avoidance challenge the robot turtle needs to move around obstacles that are in it's way. This can also be used together with a line follower challenge to force a change of direction around the circuit.
The Funduino turtle includes an ultrasonic range finder mounted on a stepper motor which makes it ideal for obstacle avoidance challenges. Visual designer includes high level access functions such as ping() to help control the turtle and the environment containing the obstacles can easily be created or changed in a graphics package.
Running the simulation at any time will then show you how your turtle program will interact within the environment and you can switch to the real hardware at any time via the program button.
Maze Escape
A maze solver or a maze escape is probably the most difficult of the standard challenges for robot turtles. It can be drawn in many ways, including obstacles or simply using dead ends in an attempt to trap the turtle.
The controlling program needs a 'memory' of routes travelled as well as sufficient logic to turn and/or reverse on the line. The Zumo turtle with its gyroscope and compass has accurate orientation methods such as turnSouth() in Visual Designer to help with this but it has no range finder and is best used with dead-end maze challengers. By contrast, the Funduino has a range finder to avoid obstacles but has no position encoding at all so the turning of the turtle is quite challenging.
As always, mazes of varying difficulty can be sketched very simply in a graphics package and the program written in flowchart or Arduino C++.
Mechanical Forces
It is important to understand that while the electrical model of the turtle in Proteus is extremely accurate, the purpose of the simulation is to test and refine control algorithms for the turtle robots. There is no attempt to model a physics engine during simulation which means that real-world forces such as inertia, friction and momentum will not be present in the simulated environment. Such forces also vary substantially in the real world (e.g. turtle on carpet vs wood flooring) and programs should be written with that in mind.
Proteus is ideally suited for the teaching, development, testing and debugging of turtle programs in different environments but turtle behaviour may differ in the real world as a result of mechanical forces.
The Arduino and Genuino names and logos are registered trademarks of Arduino LLC and their respective owners in various territories. The Proteus Visual Designer for Arduino AVR product is not directly connected or endorsed by any Arduino trademark owner.