3. AlaMode Arduino – Connect to the Pi’s GPIO

AlaMode from WyoLum

The AlaMode from WyoLum is a pretty cool board that runs Arduino and stacks on top of the Raspberry Pi, connecting through its GPIO header for communication without external wiring. Here is a writeup of how to get Grbl Controller running on the AlaMode. I did have to make a modification to Grbl Controller to support it – not because of a problem with AlaMode, but rather due to assumptions I made on how the serial port would behave on any board running Grbl – see notes at the end of this page for details.

OK, here we go…

If you have completed the steps to setup Grbl Controller on the Pi, then you need to do additional steps to get the AlaMode working with Grbl Controller:

  1. First, configure the Pi to work with AlaMode. See this page for steps to perform.
  2. Next, fire up the Arduino IDE (“start” menu in lower left, then Programming)
  3. In the IDE, go to Tools > Board > AlaMode. Also Tools > Serial Port > /dev/ttyS0
  4. Load up a sketch: File > Examples > 01. Basics > Blink
  5. Then, Sketch > Verify/Compile (takes awhile since we are running Java on the Pi)
  6. Push the Upload button. In a few seconds you should see a green LED toggle once a second on the AlaMode

OK. Now you know AlaMode is working correctly. Next you need to get Grbl installed on AlaMode (note, the home symbol ~ can be replaced with /home/pi on the Pi, as I have seen problems with some keyboards not being configured correctly to display it):

  1. Close the Arduino IDE
  2. Hopefully you are now reading this page on the Pi (I prefer the Midori browser over Dillo)
  3. Open a terminal window to your home folder
  4. mkdir grbl
  5. Go to the Grbl home page and scroll down to the links to the various Grbl binaries and download the “Master Branch” file, which is v0.8c as of this writing is called grbl_v0_8c_atmega328p_16mhz_9600.hex and save it to the grbl folder
  6. cd grbl
  7. We need to find the arduino install, as it isn’t the same path as on the Grbl site:
  8. cd /
  9. sudo find -iname arduino
  10. From the results we infer that the necessary tools folder is in /usr/share/arduino/hardware/tools
  11. ls /usr/share/arduino/hardware/tools
  12. The last command should have shown avrdude and avrdude.conf
  13. cd ~/grbl
  14. Since your arduino version is likely 1.0.1 or above, we can use this command (refer to the info on the Grbl web site):
  15. /usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -pm328p -b115200 -calamode -P/dev/ttyS0 -D -Uflash:w:grbl_v0_8c_atmega328p_16mhz_9600.hex
  16. After running the command I saw avrdude both writing and reading (verifying) the file successfully.

Let’s see if Grbl is running.

  1. Download minicom and run it per instructions here except point it to /dev/ttyS0
  2. Type $
  3. I successfully saw Grbl output a number of command options

Now we need to make sure Grbl Controller works correctly. Due to the special configuration required of the serial port by AlaMode, you must use at least version 3.3.8 of Grbl Controller to manually enter the serial port. This is because Grbl Controller can’t see /dev/ttyS0. Additionally, version 3.3.8 supports a pre-initialized Grbl (more on that at the end).

  1. Close minicom (Ctrl A, then Z, then X and hit Enter)
  2. cd ~/github/GrblHoming
  3. ./GrblController
  4. Type in the serial port into the edit box: /dev/ttyS0
  5. Click Open
  6. You should now be able to use Grbl Controller.
Regarding version 3.3.8
Prior to 3.3.8, Grbl Controller would presume that opening the serial port would result in Grbl resetting and reporting its version. This is not the way AlaMode works – the drivers on the Pi open the port upon boot and so we lose the version report. A modification was made to Grbl Controller to send a Ctrl-X if it can’t get the the version upon opening the port. The Ctrl-X is a soft reset of Grbl and will generate the necessary version report.

 

4 thoughts on “3. AlaMode Arduino – Connect to the Pi’s GPIO

  1. As I run into some minor issues using my arduino+netbook. I have begun to wonder about an alternative setup.

    1. Would it be possible to just run grbl on the raspberry pi and not have an arduino in the loop? I have to re-count the number of IO pins I guess. I was just intrigued by this because it may eliminate the connection problems I am having on my usb-connected arduino.

  2. This page describes just such an approach! You don’t need a netbook connected – you build Grbl Controller on the pi itself and let the pi talk to the Alamode arduino-clone. All you need is a monitor connected to the pi’s hdmi port and keyboard/mouse.

    As far as running grbl elsewhere – a better solution is to use something like linuxcnc, because I don’t know of a way to run grbl except on arduino.

    • No, you only need the pi sd card. The alamode sd card is if you have written arduino code that is using the arduino sd card library – then it accesses the card on the alamode. The two cards are independent and not cross-accessible (except with special code you would have to write)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>