Connect PocketCHIP to Arduino Part 1: Serial via USB

I am a huge fan of my PocketCHIP- the handheld adapter for CHIP from NTC. However one of the Chips limitations as a hobby electronics medium is the difficulty of getting started in (what is to many) an unfamiliar controls atmosphere. Until there are more guides on how to use GPIO on CHIP we feel the fastest and easiest way to get started is to use the system one already knows. To get people started quickly we plan to show you how CHIP can be paired with the most common hobby micro-controller, the Arduino. This way you can use the simple and familiar I/O of the Arduino and manage the data with CHIP. You could take readings from sensors connected to an Arduino and easily post it on the Web, or SSH into your chip and use it to control your Arduino outputs. There really are a lot of easy possibilities once the connection is in place. Here is a look at the 4 part series on how to get information from CHIP to Arduino and vise versa.

1.) Serial via USB

2.)Bluetooth using HC-05 module

3.)Wifi Using ESP8266 serial Wifi chip

4.)Multiwire methods (UART, SPI, I2C, Discrete)

Now let’s get into part one:

Serial communication through the USB

20161002_150525

PocketCHIP has a USB port, so does the Arduino. I think you can see where this is going. The easiest way to connect the CHIP to an Arduino is simply plugging in with USB. You need a USB cord tethering them but with serial read and write information seamlessly goes back and forth. And…the main reason I got one… You can even program an Arduino via PocketCHIP. Above I have my PocketCHIP hooked up to my RoboRED and the IDE running.

From the PocketCHIP the easiest way to get the Arduino IDE is to open the terminal and type:


chip:~$ sudo apt-get update
chip:~$ apt-get install arduino

This will download and install all the necessary files to program your Arduino. Any time you want to run the IDE open the terminal and simply type


chip:~$ arduino

All the examples are there, key up Blink to test the connection.

Make sure you select the correct board and after trying to upload the sketch it should prompt you to use

/dev/ttyACM0 or /dev/ttyUSB0 as the Port. Click OK but remember which one you’re using.

20161002_15054520161002_150937

Now you can write to the Arduino over the USB serial monitor. Check out where I am using the PocketChip to send messages to a serial LCD*. You can use this same method to give any instructions to the Arduino.

20161002_152133

You can also read data from the Arduino on the USB serial monitor. This is where I’m reading an analog signal from the Arduino**.

20161003_221910

You can then save that data to a text file by opening another terminal tab and typing


chip:~$ tail -f /dev/ttyACM0 > myfile

Or, depending on which Serial to USB style your clone uses


chip:~$ tail -f /dev/ttyUSB0 > myfile

That should get you connected with the USB cable.

Thanks for reading and check back (or Subscribe) so you can see part 2 where we set up Bluetooth communication.


Notes:

*Because of the screen size it is impossible to “see” Serial Display in the Examples menu but this worked for me: File>Examples>Press the down button till you are 1 below GSM> hit enter> Serial Display. The better way to do this would be File>Open>Arduino>Libraries>Liquid Crystal>Examples>SerialDisplay>SerialDisplay.ino. But this method takes longer and I feel less like a ninja.

**The 2 millisecond delay in the AnalogInSerialOut example was a little fast for my PocketCHIP so I slowed it to 20 milliseconds. It worked very well this way.

3 thoughts on “Connect PocketCHIP to Arduino Part 1: Serial via USB

  1. Josh says:

    From Squirrel61 on the nextthing.co forum:
    Did you know you could use alt-drag to make the invisible parts of the GUI visible? Although it’s not the most comfortable method, it could make the serial debug screen visible. Or at least the button to open it.
    Thanks Squirrel61.

  2. Reader says:

    Possible typo in the instructions, ‘apt-get install update’ is invalid. Did you mean ‘apt-get update’?

  3. Josh says:

    I did and have corrected it. Thanks for pointing that out . There’s a lesson there about copy/pasting terminal prompts.

Leave a Reply

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