6.2.2018

foto Petr Bravenec

Petr Bravenec
+420 777 566 384
petr.bravenec@hobrasoft.cz

We are preparing successor of succesfull 4×232 cape for BeagleBone Black. First serie is manufacturing already. I have working prototype on my desk. It differs from original 4×232 in many ways:

  • Power supply 7-25 V.
  • 2× analog input 4-20mA or 0-10V (configurable by software).
  • 2× digital input or output.
  • 2× relay output.
  • One-wire bus for DS18B20 thermometers.
  • 2× RS232, only RX/TX signal, increased output voltage.
  • Real time clock

Using A/D converter

I was looking forward to the new cape. The board with AD converters and one-wire bus is much more interesting for me then board with four serial ports. The AD converter in BeagleBone Black can be used very easy. When configured properly, the output of the AD converter is accessed as a simple text file. To demonstrate capabilities of new board I have connected freshly charged NiMh cell and let it to discharge to 5 Ω resistor. The voltage was measured every second and saved to a file.

Simple bash script was used to measure the cell voltage:

#!/bin/bash

ADC1=/sys/bus/iio/devices/iio:device0/in_voltage1_raw
while true
    do
    TIME=$(date +%s)
    VOLTAGE=$(cat $ADC1 | awk '{print($1*2.4414);}')
    echo $TIME $VOLTAGE >> discharge-1.data
    sleep 1
    done

The 2,4414 constant is resolution of one A/D bit. The converter has 12 bits, the measuring range is 0-10 V.

Data was processed with other simple script. The values were averaged and grouped by one minute interval and the discharge time was converted to hours. I used Sqlite database to make all computation:

#!/bin/bash

rm -f data.sqlite3
cat discharge-1.data |
    awk 'BEGIN{printf("create table data(time integer, value real); begin;\n");}
        {printf("insert into data (time, value) values (%s, %s);\n", $1, $2);}
        END{printf("commit;\n");}' |
sqlite3 data.sqlite3
sqlite3 data.sqlite3 <<! |
select (time*1.0)/60.0 as time, value
    from (
        select time/60 as time, avg(value) as value
            from (select time-(select min(time) from data) as time, value
                    from data) x
            group by time/60
        ) y;
!
sed 's/|/ /;' >> data-1.csv

The the data was visualised using Gnuplot:

set grid
plot "data-1.csv" using 1:2 with lines title 'Voltage [mV]'

Five different cells are shown in the chart:

Conclusion

BeagleBone Black is amazing platform for hardware developer. The board has many peripherals ready for use onboard. Often very simple interface is needed to use peripherals of BeagleBone. When using AD converter, usually only simple resistive divider is needed. Our cape is more complex, because we need to switch betwen two different measuring ranges.

Hobrasoft s.r.o. | Contact