This topic will walk you through the process of building the robot used for the Robot Java tutorials. My goal in designing the robot was to create a relatively inexpensive robot that can be used to introduce the students to robotics programming. In doing so, I wanted to create an environment that would be as similar to the FRC robot programming environment as possible. Since our team has chosen to Java for it’s programming, the robots could no longer use the Arduinos that we had used in previous years.
What we needed was a much more powerful processor, but cost was a serious issue. As it turned out, however, the people who created the Raspberry Pi have come out with a new Raspberry Pi Zero which provides the power we need at a mere cost of $5! Of course when you figure in shipping it is really more like $12 and when you add the required SD card and Wifi dongle you are really looking at about $20. Still it is still a pretty terrific deal!
I also made the decision to use a Arduino as well. There are several reasons for this. The first is that the Linux operating system that runs on the Raspberry Pi isn’t that that well suited to controlling low level hardware (there is only one hardware PWM pin for example). In addition if we use an Arduino, we will have access to a very large library of code which can control any number of devices and sensors. This code is all written in C++ and would probably be difficult to port to the Raspberry Pi, especially since we are using Java.
The communications between the Arduino and the Raspberry Pi is done via the serial ports on both and a very simple ascii protocol is used.