Sunday, September 13, 2015

Working on MD code a bit

Well,  I worked on my detector coding a bit this weekend.  Finally.

Using the Teensy is pretty fun, I will have to admit.

In less than a page of code, I had the PWM set up for the TX pulse at the frequency and duty cycle I wanted, and I then had the interrupt service routine set up to sample with the A to D, after the end of the TX pulse.

I really like the libraries available for the Teensy.  Even though it's still Arduino sketch coding, it can do what a  normal Arduino just can't.

I have the main sample pulse at 15uS past the end of the 50uS TX pulse.  I then delay 20uS past the end of the main sample pulse, and sample again for the Ground balance sample and average the two before exiting the ISR.

All in one page of code.

No setting up ISR registers, no setting up A/D, no setting up PWM, other than a few simple defines.

Screenshot of TX pulse, Main Sample, and Ground balance sample.

Monday, September 7, 2015

Fully Assembled board

Here's the fully assembled board.  I have the Pi sandwiched between the Base board and the Grove Pi.  I like this setup, since it gives me more I/O and adds two more serial channels for me to use, even one straight from the Pi.  I also might like to try my Logi-Pi Spartan 6 board this way with the PMOD ports, if I can figure out the FPGA side.

The Grove is just another I2C address to the Codesys.  It has a simple little command protocol mechanism that I can talk to any of the Grove Modules via the on-board ATMega 328 mcu.

I intend to use the Grove I/O mainly for the Operator Interface that won't exit the enclosure, and use the industrial 24V out on the external I/O.  It could be a really good fit in my opinion.

I am seeing weird performance from the Grove Temp/Humidity sensors though.  Seems like a bug in their firmware, since I get the same readings in Codesys as I do the Python test code.

Base Board with Grove Pi+
Base Board with Logi Pi

Sunday, September 6, 2015

Board is done and it works!

Ok.  It's done, and it works, but I had to do some jumpering to make it work.  I originally designed the board with 2 I2C buses, but with the Teensy I had to step back a bit, and not use the 2nd I2C bus.  Turns out the I2C bus library that supports 2 I2C buses, is not compatible with the Adafruit libraries for the IMU.

This just means one I2C bus with all of the I2C traffic control from Codesys and my custom driver profile (actually 2).

I had to mount a riser to the IMU so that it cleared the Pi ribbon, and the DAC adapter did indeed turn out to be horrendous.  But it works, which for a prototype board is good.  I didn't even have to cut traces, which to me is a win.

There are are a lot of milestones I met with this board.

  1. Board layout software (Eagle 6.6.0) worked well, and generated good Gerber files.
  2. OSHPark did a phenomenal  job on making the board.  I can't say enough good things about them.
  3. The design worked.  Yes, I forgot some missing jumpers, but the design is now proven to work.
  4. Through hole is still king for me right now for ease.  That single SSOP16 to DIP adapter for the DAC  has proven the most work.  I know I should have checked, but I would ASS U ME, that the nice, wonderful, super cheap adapter you bought, isn't screwed up right? **cough Sparkfun**.   I will avoid SMT until I get my reflow oven built, and get setup for it.
  5. My several parts I made were perfect, and I am very happy with the overall look and layout of the board.
  6. I last designed a board using Ultiboard in 2002.  Ultiboard and Ultirouter cost $10000, and getting a board made cost between $1000 tooling and setup and $50-$100 each per board.  Now I use Eagle at $200, and it cost me $95 for 3 boards.
Brand new PCBs from OSHPark

Assembled Board running.

FAIL SSOP to DIP adapter fix


Thursday, September 3, 2015

Finished Board design for Pi and Teensy Controller

Ok.  I've finished my board design I've been working on.  This board will provide the following features:
  1. Interface from Teensy 3.1 to Pi (I2C) from Codesys
  2. Adafruit 10 DOF IMU
  3. RS485 Serial Connection
  4. Pluggable Terminals
  5. 24V isolated digital inputs
  6. 24V isolated digital outputs
  7. 4 ch analog inputs, buffered
  8. 4 ch analog outputs, buffered
  9. Real time Clock
So far, all the circuits should work, so I'm going to send the board off to be made.

Back with more later..

Awaiting boards to come in..

Well, I created a PCB around the Teensy, and am currently waiting on parts.  I have received most of the parts, but still am awaiting delivery of the PCB and op amp buffers.

I screwed up my DAC footprint.  Turns out Sparkfun's SSOP to DIP footprint doesn't follow a DIP IC pattern, so I will have to make a little adapter harness for the chip to plug into.

Everything has tested out so far from the design, I will make some minor changes to the next PCB rev, but for the most part, the PCB should work ok.

Yes, it's through hole, but I wanted through-hole for simplicity's sake, and the ability to cut / solder traces if need be.  It's still not too big.  I will keep the same size on the next rev, and just shrink components and add more features.  Perhaps add some more channels or something.

Here are some pictures of the PCB..