# FreeBSD for DAQ on tiny computing boards?



## obsigna (Nov 23, 2016)

In the moment I got some Data Acquisition Installations running FreeBSD 11 on Intel Atom boards using National Instruments PCI boards for A/D, D/A and DIO.

I am looking for alternatives which would be less expensive and perhaps somewhat smaller in size, so I could eventually embed the computing into the measurement device. Anyway, I want to stay with FreeBSD.

I guess, I could go for a Raspberry Pi and plugin a non-expensive USB-DAQ module. However, my dream would be something like the RPI but with on-board ADC and DAC and DIO. Do such things exist? Are there other alternatives for Data Acquisition on small computing boards, that are able to run FreeBSD? Perhaps something using x86_64?

I wrote the kernel module for the NI-PCI boards myself, and I am confident, that I can repeat similar efforts for other devices as well.

Please may I ask for somebody pushing me into a promising direction?


----------



## Phishfry (Nov 23, 2016)

I don't think that most boards do more than DIO. The Beaglebone is the only one I know of that does analog and digital IO.
The x86 based Minnowboard Turbot is nice for digital input/output but I am having trouble identifying pins. Brand new GPIO driver there.

The AMD based pcEngines APU1D has a solid 16 pins of GPIO input-output supported by gpioctl. Low Power. Input power is good I have found. It boots at 7.4v. had it up to 14V. I am making an rugged chassis for it next..Not quite tiny..It is a router board that does GPIO.

Still making my Turbot case. I have 6-each 18650 Li-Ion batteries for power backup on one side of case and the board on the other. I am using the Tin Can Lure which adds mPCIe slot and mSata slot on the bottom expansion and I am piping the gpios to a terminal block mounted on exterior of the case.

The Arduino is pretty popular. I never did much with mine.
I like the versatility of x86 solutions.

Alot of the ARM solutions use an expansion Cape, Lure or Hat to provide the extra features you may require.


----------



## obsigna (Nov 23, 2016)

Phishfry, thanks a lot for your suggestions.

In the meantime I looked closer at the Beagle Bone Black and the Raspberry Pi. For the RPI I saw an expansion card with 2 ADC and 2 DAC channels. Are these expansion cards compatible between these boards?

I read something about the Arduino, but I didn't read further because it seemed that FreeBSD won't run on it, did I read wrong? Shall I look at it once again?


----------



## Phishfry (Nov 24, 2016)

The BeagleBoneBlack and Raspberry Pi use different pinout for the expansion. The Raspberry Pi 26/40 pin expansion is used by some other boards too. Notibly Orange Pi, Banana Pi, Odroid C1 all using the same pinout. The Turbot uses the same pin count but different pinout.

The biggest pain on Arm is the Device Tree. There is no plug and play. Everything must be compiled into the device tree.
So to get a cape working you need to find a Vendor DTS file that describes the cape hardware and merge the contents into your boards DTS file.
On top of that it has to go into the hierarchy in the correct location.

I would say this. The battle to put out the cheapest board really does not fare well for features.
I really don't consider them a viable commercial solution when they lack RTC battery pins.


----------



## Phishfry (Nov 24, 2016)

I am not trying to denigrate The Pi people. Their stated goal is :
"We provide low-cost, high-performance computers that people use to learn, solve problems and have fun"

Using them as an embedded computer in an commercial environment is different task.
Can it do commercial tasks.
Yes.
Would I stake my job on it?
No.


----------



## Phishfry (Nov 24, 2016)

The Arduino does not run FreeBSD but there is a port for the IDE. The device is real basic microcontroller that you program with sketches.
Their term for code projects on their IDE software. They have many nice templates.


----------



## Phishfry (Nov 24, 2016)

The BeagleBone line to me seems to be the most oriented to I/O. They have a newer version the green board without hdmi.
The onboard eMMC is a nice feature. Flash the OS to it and use microSD card for data or backups.

This place sells the newer green boards.
https://www.seeedstudio.com/


----------



## Phishfry (Nov 24, 2016)

Here is a good list of tiny boards:
http://hackerboards.com/catalog-of-81-open-spec-hacker-friendly-sbcs/

The Odroid C2 rates good here.


----------



## obsigna (Nov 24, 2016)

Thank for the various links. I need/want a complete operating system on the controller, and I choose FreeBSD for this. I will check the lists keeping my demands in mind.

PS: I guess, I need to look more closely at the MinnowBoard Turbot.


----------



## Phishfry (Nov 24, 2016)

Alot of the embedded device manufacturers make a Pico-ITX board. The Turbot is price competitive.
Not all offer GPIO due to limited real estate.
https://forums.freebsd.org/threads/57499


----------



## Phishfry (Nov 24, 2016)

One feature of the Beaglebone not found in other boards is the PRU
http://www.righto.com/2016/08/pru-tips-understanding-beaglebones.html


----------



## Phishfry (Nov 24, 2016)

I would like to hear rough details of your DAQ installations. Number of sensors and generally the importance of the systems. Are these life critical?
Understanding the duty cycle leads to the best advice.


----------



## obsigna (Nov 24, 2016)

In the present incarnations these are controllers/operators for electrochemical laboratory devices, and these are based on FreeBSD 11 running on Intel Atom Mini-ITX systems with National Instruments PCI-6251 DAQ boards plugged-in.The really expensive piece in this setup is the DAQ board - the quotation of today reads US$ 1311.00

The system is used like a headless server, and all user interaction occurs via a web interface. For this I developed a compact Web/DAV server + AJA(X) responder with integrated DAQ processing. The binary got a size of 540 kB.

In idle mode, i.e continuous ADC of 2 signals at full DMA sample rate (1 MS/s) and providing a moving average to the AJAX responder, the CPU utilization is 9 %. This increases by 0.25 % for each logged-in client sending continuous AJAX requests.

In method measurement mode, for example voltammetry, the CPU utilization rises to 100 %, because processing of the raw data involves some math, and in addition, the data is directly plotted into an SVG diagram which is updated incrementally in the responses to the clients AJAX requests (s. screenshot of a logged-in Mac Safari browser). Other methods involve even more post-processing like FFT.

The measurements are stored into files that are available by a DAV share, and users and settings are stored in PostgreSQL database tables. This is the high-end application, and for some methods, the NI PCI-6251 is driven already to its limits, and for this kind of applications I am just after *more bang for the bucks*.

However, I am now exploring less demanding usage cases for my Web/DAV/AJAX/DAQ server. A customer asked me to develop an embedded WLAN/Web-Interface for an industrial device, and in this application 10 kS/s of 2 ADC signals and 1 kS/s for 1 DAC signal would be completely sufficient, I would need also a few DIO lines for switching and status reading, that's it.

I saw an ADC/DAC card for the Raspberry PI 2/3 matching the specification with a price tag of !! US$ 13.00 !!, that is 100 times less than my current NI solution. Granted, I know this is not comparable, given that the NI is a high performance device with hundreds of bells and whistles. The Mini-ITX board doesn't hurt me, and I would happily go with Mini-ITX again, or with one of it's successors (either of Mini-STX, Nano-ITX, Pico-ITX). Still, I am in need for a much less expensive ADC/DAC solution. USB devices from Measurement Computing start at US$ 180.00.

If I could find something in the range from US$ 50 to 98.50 for (2x 12bit ADC + 1x 12 bit DAC, + 4x DIO, + 1x Timer, 10 kS/s), either of USB or miniPCIe, I would forget about the Raspberries, Beaglebones, etc.

So, for low-end applications I need to spend *less bucks for the bang*.


----------



## Uniballer (Nov 24, 2016)

Quantity makes a big difference.  If you needed a million units then it would pay to design exactly what you need on a single board.  I assume you need a few tens of units (or less) so you don't have any board design funds in your budget.

If I was in your position, and had enough time, I would definitely buy one of the $13 boards and see how far it could go.


----------



## Phishfry (Nov 24, 2016)

You really can't beat the range of accessories available for the maker boards.


----------



## obsigna (Nov 24, 2016)

Uniballer said:


> Quantity makes a big difference.  If you needed a million units then it would pay to design exactly what you need on a single board.  I assume you need a few tens of units (or less) so you don't have any board design funds in your budget.



I tend to believe that the future sales is proportional to the inverse of the square of the unit price. Ten would be the break even, when it comes to hundred I would start with smiling. Sooner or later I will need some own ADC/DAC/DIO designs.  



Uniballer said:


> If I was in your position, and had enough time, I would definitely buy one of the $13 boards and see how far it could go.



Well, I definitely should have a closer look at some of the tiny ARM boards + expansions cards.


----------



## obsigna (Nov 24, 2016)

Phishfry said:


> You really can't beat the range of accessories available for the maker boards. Be advised you get what you pay for. Like the BBB motor controller capes. There are cheap motor capes sold and there are $200 capes that are used by LinuxCNC builders.
> I am of the philosophy of throwing money at the problem. I don't want to spent 2 weeks figuring out how to get a RTC working to save $5.


As always this is a matter of perspective. I totally agree with you when we look at it from a user/consumer perspective spending time with disgusting shortcomings. From a supplier perspective additional costs are multiplied and counter efforts are divided by the number of units sold, and therefore spending some efforts in optimizing cost effectiveness pays back for you and your customers. I am not telling to make it cheap by all means, I am talking about giving quality at the least possible costs. And the optimization starts with keeping out anything that is not needed, and by this way we won't only reduce costs but improve also the maintainability in general.


----------



## Phishfry (Nov 24, 2016)

Sorry I deleted that rant. Your application looks amazing. You really made great stuff there.

Are you looking at boards like the MCP3208?
http://www.ebay.com/itm/111769832398


----------



## Phishfry (Nov 24, 2016)

So i guess the question is what adc chip is supported. Loos has this for beaglebone:
https://lists.freebsd.org/pipermail/freebsd-embedded/2014-March/002286.html

I see the MCP3208 is supported on Linux by this driver.
http://lxr.free-electrons.com/source/drivers/iio/adc/mcp320x.c


----------



## obsigna (Nov 24, 2016)

Phishfry said:


> ... Are you looking at boards like the MCP3208?
> http://www.ebay.com/itm/111769832398



I started my search yesterday, and I found this one: https://www.abelectronics.co.uk/p/74/ADC-DAC-Pi-Zero-Raspberry-Pi-ADC-and-DAC-expansion-board. Actually, it comes for US$14 and not 13 (£11.5). Actually the MCP3208 gives a direction, but is missing the analog output. Looking at your ebay link and clicking around, I found this one, which looks even more promising:

http://pi-plates.com/daqcr1/

Now I am searching for a similar thing for the BBB, since I would prefer the BBB over the RPI3.


----------



## Phishfry (Nov 24, 2016)

That looks like a solid solution with a company brand behind it for support.
The best thing going for Pi3 is the size of the user base.

http://hackerboards.com/group-buy-site-launches-40msps-adc-beaglebone-cape/


----------



## Phishfry (Nov 24, 2016)

PRUDAQ has no analog outputs either.
https://github.com/google/prudaq/wiki


----------



## obsigna (Nov 24, 2016)

Wow: on you hackerboards link: Group-buy site launches 40Msps BeagleBone ADC cape

40 MSamples per second for US$ 79, that is amazing.

PS: Now I see, you found this one also.



Phishfry said:


> PRUDAQ has no analog outputs either.
> https://github.com/google/prudaq/wiki



Well, this is certainly going into the high end application, and here is room for another DAC board.


----------

