This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
anchordemo [2021/06/07 20:59] dpisuperadmin [Applications] |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Anchor Demonstration Board ====== | ||
| - | |||
| - | ==== Introduction ==== | ||
| - | 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. | ||
| - | |||
| - | |||
| - | ==== Overview ==== | ||
| - | {{ :: | ||
| - | * Peripheral and hardware selection | ||
| - | * Physical construction and wiring notes | ||
| - | * Linux configuration | ||
| - | * Applications | ||
| - | * distance | ||
| - | * rgbled | ||
| - | * motordemo | ||
| - | |||
| - | ==== Peripheral and Hardware Selection ==== | ||
| - | 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 ([[http:// | ||
| - | |||
| - | The second application uses a quad slide potentiometer peripheral ([[https:// | ||
| - | |||
| - | The third application uses a rotary encoder to control the speed and direction of a DC motor. | ||
| - | |||
| - | The command ' | ||
| - | < | ||
| - | Slot/ | ||
| - | 0 / enumerator | ||
| - | - 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 / | ||
| - | - display : dpget dpset | ||
| - | - segments : dpget dpset | ||
| - | 4 / | ||
| - | - led : dpset | ||
| - | - config : dpget dpset | ||
| - | 5 / | ||
| - | - 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 | ||
| - | - encoder : dpget dpcat | ||
| - | - led : dpget dpset | ||
| - | 9 / | ||
| - | - display : dpget dpset | ||
| - | - segments : dpget dpset | ||
| - | 10 / gpio4 Quad General Purpose Input/ | ||
| - | - pins : dpget dpset dpcat | ||
| - | - direction : dpget dpset | ||
| - | - interrupt : dpget dpset | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== Physical Construction and Wiring ==== | ||
| - | TBD with final construction | ||
| - | |||
| - | ==== Linux Configuration ==== | ||
| - | We use an ODroid XU4 [[https:// | ||
| - | |||
| - | A minimal Linux distribution is appropriate of this simple demo unit so we choose DietPi ([[https:// | ||
| - | |||
| - | We enabled / | ||
| - | < | ||
| - | [Unit] | ||
| - | Description=/ | ||
| - | Wants=network-online.target | ||
| - | After=network-online.target dietpi-boot.service | ||
| - | |||
| - | [Service] | ||
| - | Type=forking | ||
| - | ExecStart=/ | ||
| - | 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=/ | ||
| - | DeviceAllow=/ | ||
| - | DeviceAllow=/ | ||
| - | ProtectSystem=true | ||
| - | ProtectHome=read-only | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=multi-user.target | ||
| - | </ | ||
| - | |||
| - | We start our three application program from / | ||
| - | < | ||
| - | |||
| - | #!/bin/sh | ||
| - | ### BEGIN INIT INFO | ||
| - | # Provides: | ||
| - | # Required-Start: | ||
| - | # Required-Stop: | ||
| - | # Default-Start: | ||
| - | # Default-Stop: | ||
| - | # Short-Description: | ||
| - | ### END INIT INFO | ||
| - | |||
| - | . / | ||
| - | |||
| - | / | ||
| - | sleep 5 | ||
| - | daemonize / | ||
| - | daemonize / | ||
| - | daemonize / | ||
| - | |||
| - | exit 0 | ||
| - | </ | ||
| - | |||
| - | ==== Applications ==== | ||
| - | We chose to implement the demo application as three stand-alone application. | ||
| - | |||
| - | === distance === | ||
| - | The C implementation of the distance application uses blocking reads of the us8 peripheral followed by a write to the lcd6 peripherals with the distance in inches. | ||
| - | < | ||
| - | dpset us8 enable 1 | ||
| - | dpcat us8 distance | ||
| - | dpset lcd6 display %7.1f | ||
| - | </ | ||
| - | |||
| - | === rgbled === | ||
| - | The rgbled has two events that affect execution flow. The first is a reading from the quad potentiometer with a new setting from the user. The second event is a timeout. | ||
| - | < | ||
| - | dpset ws28 config 1 | ||
| - | dpcat slide4 positions | ||
| - | dpset bb4io leds %x | ||
| - | dpset ws28 led 4 %x | ||
| - | </ | ||
| - | |||
| - | === demomotor === | ||
| - | |||
| - | |||
| - | |||