Monday, August 17, 2015

Back again again!

Ok.  It's been a while since I've posted.  I've been very busy, both at my day job, and my home projects.

The metal detector robot project is in a holding pattern, as I've been developing and testing my "infrastructure" environment.

As you know by now, I've standardized around Codesys on the Raspberry Pi.  The version for Codesys is now at v3.5sp7.  I had quite a bit of trouble updating my project past sp6, but I'm over that now.  I think.  The good thing on that is that it will make new users and easier path to start.  The biggest improvement was the addition of Ethernet/IP adapter drivers to Codesys.  With this, and the previous Ethernet/IP Scanner driver, you can now not only interface to Allen Bradley Flex IO, but the Codesys Pi can act as Generic Ethernet/IP adapter IO.  Or you could use 1 Pi with a Scanner, and 1 Pi with and adapter.  No AB required at all.  I will be testing this soon.

Here's what I'm testing right now.

I have changed over to the Teensy 3.1 platform.  I really like this little guy, it's a fantastic chip/module really.  I use TeensyDuino with it (which is an add-on to the Arduino IDE), so all the libraries that work with Arduino and sketches out there work with the Teensy.

Here's a couple pictures:
Teensy Top Pinout

Teensy Bottom Pinout

I have interfaced the Teensy to the I2C port on the Raspberry Pi.  Using a modified I2C device profile in Codesys, I can transfer data back and forth with the Teensy from the Codesys PLC environment.  My previous testing with Codesys on the Pi showed the potential of embedding the Pi Camera into a web visualization screen, and that works pretty well also.  It's not perfect, but its really pretty good.

My latest testing has involved testing the I/O capabilities of the Teensy, and the Arduino environment, which I was new to.  I have to say I am pretty impressed.  Having used Propellers in the past, I was leery about single threaded processors, but the interrupts and "software based task control", has proven very easy to use and mostly painless.  I did run into trouble getting the two I2C ports on the Teensy to work.  The libraries for the I2C modules out there are designed around Arduino single I2C modules and don't play nicely together.

This is getting me closer to my goal of a high level Linux  environment coupled with high speed low level control.  I will come back to the Prop world if the Prop2 is ever finished, but I will probably be dead of old age by then anyway.  Who knows.  Or the Xmos if they ever figure out how to make an I2C slave work.  They seem perfectly happy having USB Audio to play with.

Anyhow, here are a couple quick videos of the Teensy running interfaced to the Pi.

The first video shows the very early testing of the I2C interface between the Pi and the Teensy.  Simple 10 bytes in and 10 bytes out.  The PLC task is set at 20ms.  The Teensy seems to be able to flash the LED at that rate with no problems.



Here is the further testing setup on my PPDB breadboard.  There is a Parallax 2x16 serial LCD module, a DHT11 temp/humdity sensor, the ADC ch 0 wired to a pot on the development board, and a 2nd LED.  The LCD serial strings are generated by the Teensy, with the data from the sensors on board.



In this video, the relay board is added.  These relays are driven from the top level Codesys program, in a "Kit-Like" side pattern.