I was asked to create a diorama of a Mosquito model aircraft with powered engines.
The two electric engines are mounted in the Mosquito model aircraft engine cowlings. The motors are 8mm diameter AliExpress motors. The are encased in Sugru resin to reduce noise but mainly to hold them in position. The circuit is simple - the motors are controlled from the PIC via a BD681 with the base connected to via a 1k resistor - all very simple.
The control program is shown below. This is a user story - the story of what the engines should do. They can define the engine story and then recompile the source (and program the chip) to play thru the user story.
This uses the concept designed by Chris Roper - it is very cool!
User Story
This story starts each engine. Left then Right engine. The Left engine is idling when the Right engine is started. When both engines are idling the control is for both engines. Then, after a period of full power the engines are returned to idle then stopped. This is repeated forever. There is the RANDOM function to give differences to each user story execution.
The GCode program does all the real work. It sets up the chip, PPS etc. The user story is #inserted into the GCode and then the user story calls the methods defined in the GCODE.
The GCode uses two different type of PWM, and a few macros with the user story using constants and variables defined in the GCODE.
Completed project. This version exposes the constants in the user story.
The user story is:
- Start one of the engine, then the other. This is random. It could start the left or right engine.
- When trying to start the engine try up to five times to start the engine. When trying to start the engine use the starting technique.
- When an engine starts the power is set to minimum.
- Then, start the other engine using the same sequence.
With both engines operational - increase power to 80% and run for the specified operational time ( in seconds )
During the specified operational time run the engines at 80%
Every second of the specified operational time check the engines are operational, and, randomly (a 1 on 255 chance) fail an engine. If an engine fails then feather the engine, and, increase power to the remaining engine to 100%
Then, return the engine(s) to idle
And, finally, shut down the engines.
An operation run looks this - this is from the serial terminal. The comments are added
Normal Operations //start of user story
Starting Right Engine
Right Engine Failed to start
Starting Right Engine
Right Engine set to idle power // a good start
Normal Operations
Starting Left Engine
Left Engine Failed to start
Starting Left Engine
Left Engine Failed to start
Starting Left Engine
Left Engine set to idle power // a good start, so, both engines are running
Both Engines 5% // power up to 80%
Both Engines 10%
Both Engines 15%
Both Engines 20%
Both Engines 25%
Both Engines 30%
Both Engines 35%
Both Engines 40%
Both Engines 45%
Both Engines 50%
Both Engines 55%
Both Engines 60%
Both Engines 65%
Both Engines 70%
Both Engines 75%
Both Engines 80% // power80%
Engine status: Failure // failure
Left Engine failure
Starting Left Engine // try to restart engine!
Left Engine failure // still failed, so, feather the engine
Right Engine 85% // increase power to compensate
Right Engine 88%
Right Engine 91%
Right Engine 94%
Right Engine 97%
Right Engine 100% // complete operational time using 100%
Right Engine set to idle power // start shutdown
Shutting down Right Engine
Left Engine set of OFF
Right Engine set of OFF
next run....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was asked to create a diorama of a Mosquito model aircraft with powered engines.
The two electric engines are mounted in the Mosquito model aircraft engine cowlings. The motors are 8mm diameter AliExpress motors. The are encased in Sugru resin to reduce noise but mainly to hold them in position. The circuit is simple - the motors are controlled from the PIC via a BD681 with the base connected to via a 1k resistor - all very simple.
The control program is shown below. This is a user story - the story of what the engines should do. They can define the engine story and then recompile the source (and program the chip) to play thru the user story.
This uses the concept designed by Chris Roper - it is very cool!
User Story
This story starts each engine. Left then Right engine. The Left engine is idling when the Right engine is started. When both engines are idling the control is for both engines. Then, after a period of full power the engines are returned to idle then stopped. This is repeated forever. There is the RANDOM function to give differences to each user story execution.
The priming event simulates the misfiring of the engine, see https://youtu.be/YFQwwH-3HZI
The end goal is a small control panel that interacts with the user.
:=)
User Story
How does this work ?
The GCode program does all the real work. It sets up the chip, PPS etc. The user story is
#insert
ed into the GCode and then the user story calls the methods defined in the GCODE.The GCode uses two different type of PWM, and a few macros with the user story using constants and variables defined in the GCODE.
Last edit: Anobium 2022-11-11
The final user story.
Completed project. This version exposes the constants in the user story.
The user story is:
- Start one of the engine, then the other. This is random. It could start the left or right engine.
- When trying to start the engine try up to five times to start the engine. When trying to start the engine use the starting technique.
- When an engine starts the power is set to minimum.
- Then, start the other engine using the same sequence.
Every second of the specified operational time check the engines are operational, and, randomly (a 1 on 255 chance) fail an engine. If an engine fails then feather the engine, and, increase power to the remaining engine to 100%
Then, return the engine(s) to idle
An operation run looks this - this is from the serial terminal. The comments are added
Normal Operations //start of user story
Starting Right Engine
Right Engine Failed to start
Starting Right Engine
Right Engine set to idle power // a good start
Normal Operations
Starting Left Engine
Left Engine Failed to start
Starting Left Engine
Left Engine Failed to start
Starting Left Engine
Left Engine set to idle power // a good start, so, both engines are running
Both Engines 5% // power up to 80%
Both Engines 10%
Both Engines 15%
Both Engines 20%
Both Engines 25%
Both Engines 30%
Both Engines 35%
Both Engines 40%
Both Engines 45%
Both Engines 50%
Both Engines 55%
Both Engines 60%
Both Engines 65%
Both Engines 70%
Both Engines 75%
Both Engines 80% // power80%
Engine status: Failure // failure
Left Engine failure
Starting Left Engine // try to restart engine!
Left Engine failure // still failed, so, feather the engine
Right Engine 85% // increase power to compensate
Right Engine 88%
Right Engine 91%
Right Engine 94%
Right Engine 97%
Right Engine 100% // complete operational time using 100%
Right Engine set to idle power // start shutdown
Shutting down Right Engine
Left Engine set of OFF
Right Engine set of OFF
next run....