This is a demonstration how a Netduino 3 board, four Adafruit Motor Shields, nanoFramework (https://nanoframework.net/) and Visual Studio 2017/C# can drive sixteen fischertechnik motors simultaneously smoothly accelerated and decelerated. fischertechnik is a German construction kit.
The modelOn the bottom there are 8 fischertechnik S motors, ontop 4 S motors, 3 XS motors and one older 6V Mini Motor. The red 15 mm connectors give a nice view of the motors spinning.
One 9V power supply delivers power to the four Motor Shields and thereby the motors themselve, another power supply is used for the Netduino board (at the bottom). Each Motor Shield can drive up to four DC motors (or two stepper motors, for which a demo will follow also).
The normal onboard LED of the Netduino is smoothly lit up and dimmed again using its own thread in order to see if the board is still operating, and to demonstrate how smooth other things can be done while the CPU is busy with smoothly accelerating or decelerating the 16 motors and the I²C traffic necessary for that.
The three GoPort LEDs of the board are used to show the number of motors which have not yet reach the current target velocity during the smooth acceleration/deceleration: 1, 2, or 3 LEDs light up when 1, 2 or more than 2 motors have not yet reached their target speed. Every time when all motors have realized the target velocity, the three GoPort LEDs are off and a pause of thee seconds is made before the target speeds get changed again.
The software is example Sample08SmoothManyAnalogOutputs
of my abstract I/O framework (https://github.com/steffalk/AbstractIO). The demonstration is the fully board-independent Sample08SmoothManyAnalogOutputs
(see https://github.com/steffalk/AbstractIO/blob/master/source/AbstractIO.Samples/Sample08SmoothManyAnalogOutputs.cs), and the actual I/O objects of the Netduino and Adafruit boards are simply passed in.
I/O transformations using a simple to use fluent API: In this example, a simple I/O transformation is used to limit the voltage of the old fischertechnik motor to 6V instead of 9V just by coding:
shield3.GetDcMotor(1).Scaled(factor: 6.0 / 9.0)
)
The same is used to handle that one motors has its pins swapped (for demonstrating the framework) just by coding
shield4.GetDcMotor(1).Scaled(factor: -1.0)
There are many other transformations available for both input and output. See input transformations and output transformations. Let a lamp blink instead of just light up? Attach a single BlinkedWhenTrue
transformation! Let it smoothly blink? Just throw in an additional Smoothed
transformation! Replace a button with an analog photo cell light barrier? Attach a simple SchmittTrigger
transformation to the IAnalogInput to get an IBooleanInput.
Comments