Archive for the ‘Arduino’ Category

We, as a team from the Federal Institute of Sergipe (Aracaju, SE, Brazil), have started to meddle with robotics about half a year ago. After some hard work with the hardware and mechanical aspects of the build, we headed to the most crucial thing: the algorithm, intelligence itself. There, we’ve hit an obstacle. A considerable one.

“Talos”, the Robot

First, we’ve tried to use the LEGO Mindstorms EV3 software, the one where you use blocks to build programs directly to the brick. That, proved very unsustainable as we move along. The code kept getting bigger, and more unclear to work by as it grew. As we’ve kept getting the needs for a clear code interpretation and source sharing, it was no longer an option.

We’ve then tried a couple other options, as the LeJOS and EV3DEV, but as we we’re implementing an Arduino Pro Mini and an Arduino UNO, we needed a better grasp on the protocols that runs between them. We’ve decided to use I2C and found out that both of the options didn’t have the tools needed to debug and test with. That along with the inconsistency (the robot just didn’t work for no reason 1 out of 20 times), have presented us with a challenge.

There were times when we just didn’t know if a software/framework with the tools we needed existed. We still had an option, we had to try ROBOTC.

We haven’t done it before on one fact: It was paid. But it had a 10-day trial, and we still had to try. And it was fantastic.

We could instantly try it out, it had a firmware of it’s own (with a 1-click install, which makes thing extra-practical) and a really smooth learning curve. An extensive documentation, a really broad community and many many tools to debug from. But does it have an I2C test utility? Yes. It has. The code became clearer, the problems we’re gone, we could share the code on Github, it was magical. It even has a couple plans of payment for teams and or students.

I’d suggest ROBOTC to every EV3/NXT user, it is simply the best all-together tool out there.

This is the first in a series of posts that will explain the new functionality behind the latest ROBOTC update. Beginning with ROBOTC 3.5 with all of the new functionality towards becoming an ANSI-C compliant language has brought some changes that may confuse veteran ROBOTC users. This week we’ll take a look at how global and local variables work in ROBOTC.

In previous ROBOTC releases, the compiler (the engine that converts your code from C-language to machine language) would treat all variables as “Global Variables” and would allocate (assign memory to) every variable when the program was compiled. This method caused issues because it would not allow the compiler to understand re-entrant functions (i.e. functions that could call themselves). This functionality was limiting because it prevent a key computer science concept called “Recursion” which is the ability to have a function call itself repeatedly (but not infinitely). Recursion is very useful when dealing with sorting data or calculating a series of data in different algorithms (one example: calculating a Factorial value – 5! = 5*4*3*2*1)

Example of Recursion: Calculating a Factorial Value

In ROBOTC 3.5, the compiler’s functionality has been extended in order to support recursive functions by supporting the concept of “Call Stack” variables. The idea of the Call Stack is that ROBOTC will now store local variables and return addresses of functions onto a Call Stack – This unlocks the ability to have recursive functions and variables that are truly “local”. With the Call Stack, ROBOTC is able to keep track of multiple calls of the same function and coordinate all of the variables so there’s no accidental overwriting of data or multiple copies of the same variables to keep track of – Everything automatically done by the compiler when the program is run!

A visual look at a “Call Stack” (from Wikipedia)

With the call stack, ROBOTC’s firmware assigns the memory address of local variables when they’re declared in the code (as opposed to compile time as before). Variables are allocated and discarded on the stack as needed – users do not need to modify their code to take advantage of this functionality. Programs do still need to specify a variable’s type and size ahead of time however. (i.e. no dynamically sized arrays)

Three different ways to allocate variables.

There is one big difference when it comes to debugging – users will see the old “Variables” display is now split between “Global” and “Local” variables in the ROBOTC Debugger. Because the ROBOTC IDE doesn’t know where the variable will be stored in the “call stack”, there’s no way to accurately know where the local variables are on the stack at any one time. What this means is that you will not be able to view your local variables during run-time like in previous versions of ROBOTC. This is a limitation of professional IDEs (Visual Studio, Eclipse, AVR Studio) that also support recursion and variable stacks. The new extended ANSI-C functionality brings ROBOTC close to the same level as those development environments including the same limitations when debugging.

Hey where are all of my variables?

The good news is that users have two options for debugging their program’s variables:

Suspend your program by using the “Step” button– When the program execution is suspended, the IDE is able to display all of the current local variables for the current function/task selected. This will not display every local variable in your program, but only the currently executing function/task.

When the program is suspended, ROBOTC can load the “Call Stack” and display Local Variables accurately.

Use Global Variables– Because Global Variables are allocated at compile time, the ROBOTC IDE knows the memory location of every Global Variable and can keep track of these variables in the “Global Variables” debugger window. All Global Variables will be continuously updated as the program is executed.

With Global Variables, ROBOTC know the address of the Variable at all times, so it is able to always display the value.

We understand some of the frustration that ROBOTC users are experience with the new ROBOTC 3.5 update with all of the new functionality, and we apologize for any issues. Our overall objective is to make ROBOTC as close to a true ANSI-C programming environment to make sure students and users are learning proper coding techniques.

As we continue to refine our implementation with the latest version of ROBOTC, we still are committed to addressing any reported issues and would love to hear from you if you are having any problems – Please send us a note using our Ticketing system at http://www.robotc.net/support/ or directly at support@robotc.net.

The ROBOTC Development team is proud to announce that ROBOTC 3.50 for the LEGO Mindstorms, VEX Cortex and PIC, Arduino, and Robot Virtual World platforms is now available! The new ROBOTC 3.50 update is free-of-charge for ALL existing ROBOTC 3.0 license holders. Download today and try out all of the new features and enhancements available in ROBOTC 3.50!

Change log for ROBOTC 3.50 (since version 3.08):

MAJOR UPDATES:

Full ANSI-C support to support pointers, recursion, and stacks with an updated compiler and updated robot firmware.

New and Updated Debugger Windows:

“Local Variables” to monitor variables in the current task or function.

(Note: Local variables are only available when your program is suspended)

“Global Variables” to monitor variables available to your entire program.

“Call Stacks” to monitor function calls in the currently selected task.

NXT I2C sensors were incorrectly initializing clock and data lines as outputs when first configuration. They were correctly left as inputs after first message was sent. Change was to initialize as inputs. Before change, the first I2C message on an empty port will incorrectly appear to succeed.

Changed Checkmarks to Radio Icons for many menu items. This shows a “dot” instead of a “check mark” in the menu icon field.

Created tooltip strings in resource file for all missing commands.

Prepare to add two new Debugger panes to display “Breakpoints” and “Bookmarks”. Based on the existing “Compiler Errors” pane architecture. The new panes are displayed but the content is still empty.

Better synchronization of breakpoints between “Source File” and “Disassembly Listing”. Previously when breakpoint was added/removed in one window the corresponding change was not properly made in the other window. Now the breakpoint ICONs are always refreshed whenever a window is “Activated” (i.e. made topmost).

Add two new menu commands for “increase indent” and “decrease indent”.

Add partial support for new download “write to RAM” message. Needed for new “local variables” window.

Add support for new “trinary opcodes” (+, – and *) with ‘long’ operands. Previously trinary opcodes were for ‘short’ variables. Trinary opcodes are primarily used for efficient code generation for array and structure element access.

The ROBOTC Development team is proud to announce thatROBOTC 3.5 for the LEGO Mindstorms, VEX Cortex and PIC, Arduino, and Robot Virtual World platforms will be available on September 7th, 2012. The new ROBOTC 3.5 update will be free-of-charge for ALL existing ROBOTC 3.0 license holders. Download a Beta version (3.45) today to get a sneak peak at all of the new features and enhancements available in ROBOTC 3.5!

ROBOTC 3.5 has a number of new features and enhancements:

Full ANSI-C support to support pointers, recursion, and stacks with an updated compiler and updated robot firmware.

New and Updated Debugger Windows:

“Local Variables” to monitor variables in the current task or function.
(Note: Local variables are only available when your program is suspended)

“Global Variables” to monitor variables available to your entire program.

“Call Stacks” to monitor function calls in the currently selected task.

Many general enhancements and bug fixes – more in-depth change log to come with the ROBOTC 3.5 official release.

Please remember that the Beta available today should not be installed across entire school sites–this is a beta version, so install at your own risk!

You can participate in the ROBOTC 3.45 Beta version by downloading a copyhere. Please note that the Beta version will uninstall your existing version of ROBOTC; the Beta will use your existing licensing so there is no need to ‘Deactivate’ before installing. If you have any issues/questions with the ROBOTC Beta, please e-mail betasupport [at] robotc [dot] net for assistance and to alert us of any issues to be fixed between now and release day.

When someone thinks “robots’, they generally think of cold, calculating, emotionless machines. This couldn’t be further from the truth; all robots, from the complex humanoids to the basic welding arms seen in car plants, have complex and deep emotional personalities.

For instance, take a look at our new “Scaredybot”. Built entirely from VEX parts, an Arduino, and the sweat of our intern Dan West (by the way, great work Dan!), the Scaredybot is so ‘brave’ that it cannot stand being in the dark; given the choice, it will either chase a light source for dear life or spin blindly in place (desperately seeking a respite from the darkness).

On the technical side, the Scaredybot uses two VEX Light Sensors to compare light values on the left and right side of the robot and turns the robot towards whichever side is higher. By constantly moving side by side using swing turns (much like a line-tracking robot), the Scaredybot is able to track the light source as long as its sensors are able to read the light values. When the Scaredybot loses its light source, it spins in place until a light source is found again, at which point it starts to track it again.

The Arduino is one of the most diverse robotics platforms. It truly opens the world of modern electronics to the students by allowing them to interface with all sorts of relevant, modern technology. We have seen this unfold in our latest project with the Arduino, the RC car hacking project.

For this project, we decided a good candidate to start with would be the New Bright RC ‘Interceptor’, a larger scale car that fit a standard-sized Arduino (in this case, an UNO) and a breadboard with lots of room to spare. This surplus of space opens up tons of options for adding sensors in the future. Plus, by tapping into the car’s standard battery we eliminated the need to add a second one. Since we needed to be able to control the RC car’s DC motors with the Arduino, we decided to use the VEX Motor Controller 29 to convert the PWM signals into corresponding voltage levels. This solution was cheap, easy, and effective; a true engineering triple play.

Once the Arduino was implanted into the RC car, it was time to tell the newborn robot to do something. Of course, we did this using our favorite programming software, ROBOTC for Arduino (more on this later).

Close up on the hacked internals of the 'Interceptor'.

It is important to realize that while most robots have a tank style drive system, the RC cars have the same steering system as that found in real-sized cars (Ackermann Steering). This unfortunately eliminates the possibility of making point turns, but it does open the doors to other interesting opportunities such as parallel parking (we plan on showcasing this in a later update).

Besides being incredibly awesome, this project also helps to expand upon the superb flexibility of the Arduino and VEX systems; although not specifically designed for one another, they can easily be used together with little or no modification to either system.

We could never allow you, the reader, to miss out on the hacking. If you are interested in this or any of our other current projects, we encourage you to take a look at the tutorials on our wiki. At the moment they are works-in-progress, but we are well on the way of having step-by-step guides for hacking a variety of vehicles, with different scales and sizes, and different methods of operation. We ultimately want the tutorials to act as guides to hack any RC vehicle, even if we do not cover it specifically.

Keep an eye on this blog and our wiki for the latest updates. If you have any hacking stories, we’d love to hear about them on our forums. Good luck, and get hacking!

Electronics is an integral part of innovation, yet many electronic classes across the United States are being closed because of NCLB(1) and ever-shrinking school budgets. However, more and more schools are instead opening robotics courses. With the Arduino platform we saw an opportunity for educators to integrate basic electronic principles into existing robotics courses using the VEX, LEGO, and BoE hardware. Fortunately, Arduinos are very inexpensive and can be used not only as a mobile robot controller, but to create lots of other “smart” stuff as well.

Arduino on a NXT platform

The Arduino exposes students to a basic microprocessor concepts, prototyping on a breadboard, and basic electronics concepts through many cool projects. The Arduino takes the processor ‘out of the box’ and gives students the opportunity to ‘build from scratch’ electronics systems. To augment these features, we’ve developed lessons around LEGO, VEX, and the BoE bot at our ROBOTC wiki and by the end of the summer we will have a set of plans that allow students to turn a RC car fully autonomous. We have a team of folks dedicated to creating a series of lessons that makes teaching electronics through robots fun and easy, all while using technology that is already in your classroom.

In this regard, we have a very broad range of projects in mind for ROBOTC for Arduino; everything from basic LED control to creating homebrew sensors is covered. The end-goal for this research and development project is to expose students to a broad range of basic electronic concepts from simple circuitry to digital input (on/off switches) to analog inputs (potentiometer) to PWM concepts. As we continue to develop our ROBOTC for Arduino support materials, we need your help. We are asking you, the ROBOTC community, to recommend projects that you are working on and are willing to share with educators and hobbyists. Please consider sharing your project ideas and we will be glad to post them on both our blog and wiki. As always, keep an eye on our forum, Facebook, and Twitter pages for the most up-to-date news. Thanks!

The Arduino is a powerful and versatile piece of electronics hardware, that can be used for anything from taking sensor readings or making LEDs flash, all the way to making a robot that can be controlled from the internet. With such vast potential, getting started with the Arduino can be a little intimidating to some.

As such the ROBOTC Development Team is pleased to announce the development of a series of guided projects to introduce users to the Arduino. These projects will cover topics such as making a simple mobile robot, making your own sensors, communicating with VEX or NXT robots, and how to make and use advanced sensors. The projects will all lead up to a capstone project where you will be guided through the process of converting an RC car in to a Arduino controlled mobile robot.

If you’re interested in helping out with the development of some of the lessons, feel free to contact us at arduino[at]robotc[dot]net – We’ll be offering free licenses of ROBOTC for Arduino for anyone who contributes lessons around using the Arduino with ROBOTC.

Just in time for summer, the ROBOTC dev-team has released the first Public BETA of “ROBOTC for Arduino”. The Arduino is a cool, low-cost embedded controller board that is great for learning the basics of robotics, electronics and creative engineering.

The new version of ROBOTC has support for all of the popular official Arduino boards – Diecimila, Duemilanove, Uno, MEGA 1280 and MEGA 2560.

All of the ROBOTC features you’ve come to know and love have been brought to the Arduino, including easy motor and sensor control, the powerful ROBOTC debugger, sample program library, and many other features.

IF you’re looking to purchase an Arduino, we strongly recommend you check out http://www.sparkfun.com for everything Arduino and cool accessories!

Note: The ROBOTC for Arduino 3.12 build is still compatible with the NXT and Cortex versions of ROBOTC. Your existing installations will be upgraded to 3.12, but you will be able to use the NXT, Cortex, and Arduino all in the same version of ROBOTC.