This is an old revision of the document!
Anchor Electronics sells a selection of new and surplus Demand Peripherals boards. The project described on this page gives Anchor customers a quick, visual introduction to the Demand Peripherals product line and and open-source peripherals.
This page is organized as follows:
Our goal was to give Anchor customers a simple demonstration of the capabilities of the Demand Peripherals software defined peripherals. There are three separate applications running on the demo system.
The first is an ultrasonic distance sensor whose reading are displayed on a 6 digit LCD. The distance is shown in inches and tenths of an inch. We use the us8 peripheral (us8) and card (us8). The distance is shown in inches using the lcd6 peripheral (lcd6) and the lcd6 card (lcd6). The sensor is an Adafruit HC-SR04 (HC-SR04).
The second application uses a quad slide potentiometer peripheral (slide4) and card (slider4) to control the red-green-blue brightness of a string of eight WS2812 LEDs from Adafruit (NeoPixel Stick).
The third application uses a rotary encoder to control the speed and direction of a DC motor. The RPM speed of the motor is displayed on a second 6 digit LCD. The rotary encoder peripheral and card are the rotary encoder interface (roten) and the rotary encoder card(roten). We use a DC gearhead motor from Adafruit (Geared DC Motor). The motor is controlled with the dual DC motor controller peripheral (DC2) and the dual H-bridge card (d7hb). The motor has a magnetic quadrature encoder to measure the speed. The encoder outputs go to a general purpose IO card (gpio4) and from there to a dual quadrature decoder peripheral (quad2). A second LCD6 card and peripheral display the speed of the motor in revolutions per minute.
The command 'dplist' shows the peripherals in the system and the names of the resources available for each peripheral. The dplist for this project is shown below. Use the 'Build your FPGA Image' page (FPGA Image to request an FPGA binary with the listed peripheral. Of course you can change the requester peripherals and you can build the image from the Verilog sources if you wish.
Slot/Name Description 0 / enumerator FPGA Interface and ROM contents - port : dpget dpset - text : dpget 1 / bb4io The buttons and LEDs on the Baseboard - buttons : dpget dpcat - leds : dpget dpset 2 / us8 Octal interface to SRF04 distance sensor - distance : dpcat - enable : dpget dpset 3 / lcd6 Six digit 7-segment LCD display - display : dpget dpset - segments : dpget dpset 4 / ws28 Quad WS2812 LED driver - led : dpset - config : dpget dpset 5 / slide4 Quad slide potentiometer - positions : dpget dpcat 6 / quad2 Dual Quadrature Decoder - counts : dpcat - update_period : dpget dpset 7 / dc2 Dual DC motor controller - mode0 : dpget dpset - mode1 : dpget dpset - power0 : dpget dpset - power1 : dpget dpset - pwm_frequency : dpget dpset - watchdog : dpget dpset 8 / roten General purpose rotary encoder input - encoder : dpget dpcat - led : dpget dpset 9 / lcd6 Six digit 7-segment LCD display - display : dpget dpset - segments : dpget dpset 10 / gpio4 Quad General Purpose Input/Output - pins : dpget dpset dpcat - direction : dpget dpset - interrupt : dpget dpset
TBD with final construction
We use an ODroid XU4 ODROID-XU4Q single board computer as the controller for this project. Almost any computer will work as long as it has an available USB port.
A minimal Linux distribution is appropriate of this simple demo unit so we choose DietPi (https://dietpi.com/). We added gcc, the libc development headers, an editor (nvi) and the 'daemonize' utility. We found we did not need to install D-Bus and most of the usual desktop daemons. Dpdaemon built cleanly following the instructions on the DPI downloads page (Downloads).
We enabled /etc/rc.local with the following in /etc/systemd/system/rc-local.service.
[Unit] Description=/etc/rc.local Compatibility Wants=network-online.target After=network-online.target dietpi-boot.service [Service] Type=forking ExecStart=/etc/rc.local start KillMode=process TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes # Hardenings PrivateTmp=false CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE LimitNPROC=10 DeviceAllow=/dev/ttyUSB0 rw DeviceAllow=/dev/null rw DeviceAllow=/dev/net/tun rw ProtectSystem=true ProtectHome=read-only [Install] WantedBy=multi-user.target
We start our three application program from /etc/rc.local with the following:
#!/bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Script to recover nvi edit sessions. ### END INIT INFO . /lib/lsb/init-functions /usr/local/bin/dpdaemon -l /etc/dpdaemon/DPCore.bin sleep 5 daemonize /usr/local/anchordemo/distance daemonize /usr/local/anchordemo/rgbled daemonize /usr/local/anchordemo/motordemo exit 0