Proton BASIC Compiler - Proton Basic Compiler and Helicopters


  • Pic® Basic


  • Proton Basic Compiler and Helicopters

    I’m a relatively long time user of the Proton Basic Compiler. I purchased it early in 2006 in order to write the code for an embedded controller to install in my 2-seat experimental home-built helicopter. I’ve been flying helicopters since 1999.

    I’m an electrical engineer and have been designing embedded controllers for the automotive industry, and writing code for PIC processors for several decades. “In the beginning”, the only language available for the PIC processors was assembly language. I did this for many years, but switched to Basic when the compilers became available for the PIC processors. I don't like C.

    Proton is among the best and easiest to use among Basic compilers.

    This aircraft contains a compliment of standard flight instruments and radios, but I wanted to be able to automatically monitor additional parameters relating to flight conditions, temperatures, switch closures, tachometers and time, than my normal instruments provided for. So I designed a custom embedded controller based on the PIC18F452 that accomplishes all this for me. The system has been installed on my helicopter for over 10 years and has performed flawlessly.

    The initial motivation for designing this embedded controller was to monitor a network of temperature sensors scattered about the aircraft. But since I would have a custom embedded controller on board, I decided to add a number of additional features, including:
    1. Magnetic sensors to sense the presence of a passenger and the location of the ballast weight.
    2. Hall effect sensors to monitor the RPM of the main rotor to warn if the rpm were too high or too low, and to compare the rpm of the main and tail rotors to warn if there is any divergence in rpm.
    3. Dallas 1-wire temperature sensor network for monitoring critical bearing temperatures and outside air temperature.
    4. Magnetic sensors to detect the presence of the ground handling wheels.
    5. Fuel clock as a backup to the notoriously inaccurate fuel gauge.
    6. Battery voltage monitor.
    7. Audible warning sensor.
    8. Large 160x128 pixel, T6963 based daylight visible graphical LCD.
    9. Keypad and switches for setting up and configuring the controller.
    The center of gravity (CG) on this aircraft is quite narrow, and depending on the weight of the occupants, it may be necessary to physically move a ballast weight to one of two possible locations to compensate. It can be easy to forget to move this ballast weight, setting up a potentially hazardous CG condition. I installed magnetic sensors in the two ballast mounting locations, as well as an occupant detecting switch, to advise if the ballast is in the wrong location relative to the presence of a passenger. If the ballast is ever indeed in the wrong location, the screen will flash (and beep if I so desire) to warn me. The alert can be over-ridden if desired by pushing the “OK” button.

    The rotor RPM of helicopters is critical. The RPM must be at 100% (within a narrow percentage) at all times the helicopter is off the ground. This is true for hovering, ascending, descending and maneuvering. To fly outside the prescribed RPM band can damage the rotor system, and be hazardous to your health and well being. The original instrument panel contains what is called a dual tachometer gauge which has two needles. One needle is for the main rotor rpm, the other needle is for the engine rpm. The needles pivot on the outside edge of the gauge and swing upward. When the two needles cross each other, or “marry up”, in the “green band”, roughly in the center of the gauge, this indicates that both the rotor and engine rpm are nominal for flight.

    This rotor tach gauge did not originally have an audible alert to warn you if you neglected to notice that your rpm was not nominal. I added an annunciator that is plenty loud enough to cut through the ambient helicopter noise and the headphones, as well as a Hall effect sensor to detect the passage of magnets on the main rotor shaft as a secondary monitor of the main rotor rpm. It warns me if the rpm ever gets too high or too low.

    I also added an additional Hall effect sensor on the tail rotor shaft to monitor the tail rotor rpm. The software compares the main rotor rpm and the tail rotor rpm time measurements to determine if there is any divergence in rpm between them, which could be an indication of dangerous belt slippage.

    As mentioned previously, the primary reason for designing this embedded controller was to monitor a series of temperature sensors. I like the Dallas 1-Wire smart thermometers, and included a 1-wire network channel on the controller. Proton makes it very easy to communicate with these smart sensors.

    One cause of occasional mishaps on this helicopter is when inexperienced pilots forget to remove the ground handling wheels before lifting off. When the helicopter lifts off into a hover, the wheel weldments are free to swing below the helicopter, where they can potentially snag the ground and cause a dynamic roll over, severly damaging the helicopter and ruining your entire day. I installed magnetic switches to sense and warn of the presence of the wheels.

    The fuel gauge on this aircraft is notoriously inaccurate, requires occasional recalibration, and is sensitive to the dielectric constant of the fuel. This aircraft can burn either automotive premium fuel or aviation 100LL. If the gauge is calibrated for automotive premium, then a full load of aviation grade 100LL will show only a half tank. Conversely, if calibrated for aviation grade fuel, a half tank of automotive premium fuel will show “Full” on the gauge. So I included a time-base chip on the controller with a 1-minute interrupt. I set the fuel clock prior to every lift-off to represent the amount of fuel I know to be on board, and it tells me at a glance how many in-flight minutes I have remaining. It will also start to “honk” and blink at me if I approach the 20-minute FAA mandated fuel reserve.

    This aircraft runs on an automotive style electrical system. If the battery voltage gets too low the ignition coil packs will fail to fire. There is a voltage gauge on the panel but if the pilot neglects to notice that the battery voltage has gotten low, due to a malfunctioning alternator for instance, then the engine can stall unexpectedly. I scan this instrument as part of my normal instrument scan, but my embedded controller also monitors the battery voltage and the LCD will blink and the audible alert will sound if the battery voltage ever falls below 12.0 volts, allowing time to get on the ground safely in the event of an electrical system failure.

    I have the LCD configured to mimic a selected array of round gauges (see attached), but if any of the parameters ever fall out of range, the LCD will automatically switch to a full-screen representation of the offending parameter and blink (and/or honk depending on the severity of the alert). If the alert is cleared the LCD screen will resume displaying the previous set of selected gauges.

    Proton Basic Compiler does it all and continues to make it easy to maintain the code and add features to the embedded controller as I dream them up.

    Feel free to contact me with any questions at jmarkwolf@yahoo.com.