Microcontroller

Home | Members | Summary | Background | Scope | Design Concepts | Final Design | Testing | Conclusions | Calculations | Parts List | Site Map


Up
Microcontroller
Interface
Solenoids

Sub-Pages

 

 

Microcontroller

 

 


The above pictures are from www.parallax.com

 

        A microcontroller is essentially a very small, lower power computer that can fit onto a single chip. These chips must generally be used with a development/programming board in order for them to interact with other components.  The development board is used to regulate the power provided to the microcontroller and to provide electrical ports that allow the microcontroller to interface with other components or with a computer. Once connected to a development board the microcontroller can be connected to a computer and programmed using a proprietary programming language and development software available for download at www.parallax.com. Since microcontrollers can be reprogrammed without physically reconfiguring them this makes future modifications much simpler than with a 555 timing circuit.

Under the advice of the electrical engineer the group purchased the Basic Stamp 2 (BS2) microcontroller (shown above and right) and the Board of Education (BOE) development board (shown above and left) from Parallax Inc. The BS2 is capable of handling multiple input and output signals simultaneously, performing logic checks and operations, and basic mathematical processes. The BS2 is capable of receiving input signals of 0V-5V which it interprets as being either on or off based on whether the signal is less than 2.5V (off) or greater the 3V (on). It is important not to allow an input signal to exceed 5 volts as this could damage the microcontroller and render it inoperable. The BS2’s output signals follow a similar pattern in that they are restricted to being either off (0V) or on (5V) and are of very low amperage. This means that the microcontroller is incapable of controlling the solenoid valves directly; this issue will be addressed in a latter section.

 

 

Programming

            As the program running on the microcontroller is responsible for controlling the activation of the solenoid valves it is necessary to first understand how the solenoids in the buoyancy and resurfacing system are organized. As shown by Figure 6.D.1 valves the air line form the carbon dioxide tank split into two lines: the upper resurfacing system and the lower buoyancy system. For the buoyancy system the line passes through valves 1 and 2, the line then continues to a tee that splits to go to the bladder and valve 3. After passing through valve 3 the line continues through a one-way valve and finally out a vent and into open water. Between valves 1 and 2 is short length of pipe that is used as a control volume. This control volume allows for the calculation of exactly how much pressurized gas is being passed into the bladder. For the resurfacing system the line passes through valve four and then onto the bladder.

All valves are normally closed until opened by the control system and one valve will be opened at a time. When valve 1 opens it pressurizes a short length of pipe located between it and valve 2; after valve one closes valve 2 opens and allows the gas to continue into the buoyancy bladder. By not allowing valves 1 and 2 to open at the same the act as a kind or airlock by only allowing a certain amount of gas to pass through them in a given cycle. Valve three is used to vent the gas out into the water in order to deflate the buoyancy bladder. Valve 4 is used to inflate the resurfacing bladder

The initial solenoid valve activation schedule was created before the group had decided to use a microcontroller for the control system, therefore the initial schedule the initial activation scheme was kept very simple. As the following schedule was never used beyond the conceptual level the wait times are only approximate as they were never calculated to keep the robot in the water column. The initial activation scheme proceeded in the following steps:

  1. start of cycle
  2. wait 5 seconds
  3. solenoid #1 opens for 2 seconds
  4. wait 5 seconds
  5. solenoid #2 opens for 2 seconds
  6. wait 1 hour
  7. solenoid #3 opens for 5 seconds
  8. wait 1 hour
  9. check solar panel voltage; if 0V restart cycle, otherwise proceed to step 9
  10. open solenoid #4 for 5 seconds
  11. deactivate electronics,  End cycle

            After the microcontroller was chosen for the electronic control system the group realized that it allowed for a more sophisticated control scheme. The basic concepts of the original activation schedule were adapted for use with the microcontroller to produce the final control scheme. The new control scheme is an algorithm which essentially loops steps 2-5 a certain number of times until the robot achieves a positive buoyancy force of approximately ½ pound; this is related to how much carbon dioxide has been used thus far. In order to cut down on the amount of processing that must be down by the microcontroller the number of times that airlock needs to be cycled is calculated before hand using MATLAB, the program used to this can be found in section 3 of Appendix B. The program used for the microcontroller can be found in section 4 of Appendix B.

A full description of the new solenoid activation schedule is as follows:

  1. start of program
  2. wait 8 hours
  3. Get the correct number of times to cycle airlock
    1. solenoid #1 opens for 2 seconds
    2. wait 2 seconds
    3. solenoid #2 opens for 2 seconds
    4. wait 2 seconds
    5. Has the airlock been cycled the correct number of times? If yes go to 5, otherwise go to 4a
  4. wait 1 hour
  5. check solar panel voltage; if >3V go to 10
  6. open solenoid #3 for 3 seconds
  7. wait one hour
  8. check solar panel voltage; if >3V go to 10
  9. go to 3
  10. open solenoid #3 for 3 seconds
  11. open solenoid #4 for 5 seconds
  12. shutdown control electronics
  13. end of program

Since the control system must be activated before the robot is placed in the water an eight hour wait is placed at the beginning of the program, this allows time for the robot to be placed into the cave by divers or to sink and drift into a cave or sinkhole under its own power. Step three marks the start of the algorithm cycle. The program gets the number of times that it should cycle the airlock it then switches valves 1 and 2 on and off until the correct number of cycles has been reached. The system then waits for a period of time, the team chose to use one hour though this could be changed based experience and knowledge of the cave system. The program checks to see if the solar panel indicates whether it has resurfaced and if it has jumps to step ten otherwise it continues to step 6. In step six the program opens valve three to deflate the buoyancy bladder. Next, the program waits for one hour and then rechecks the solar panel; if it has not resurfaced it restarts the algorithm. If at steps five or eight the solar panel voltage indicates that the robot has resurfaced, the program will jump to step ten. At steps ten and eleven the program first deflates the buoyancy bladder and then inflates the resurfacing bladder. It is necessary to first deflate the buoyancy bladder since if both bladders were inflated they might overcrowd the wet portion of the housing and cause one of them to burst.

 

 

 

Supporting Programs and Calculations

The MATLAB program used to determine how many times the airlock should be cycled per inflate-deflate cycle is also used to life expectancy of the robots onboard power supplies during a mission, that is to say how long the robot can function before running out of power. The robot’s onboard power supplies consist of the 9-volt battery, the coin cell battery stack, and the carbon dioxide tank.

The carbon dioxide life expectancy is based on the number of times the airlock is cycled. Each time the airlock is cycled a discrete mass of carbon dioxide from the tank is used to inflate the bladder, the program totals how much mass has been used thus far and records how many inflate-deflate cycles have been performed by the time the amount of carbon dioxide used exceeds the amount of carbon dioxide available from the tank.

The 9-volt battery life expectancy is calculated by using the number of times solenoid valves 1, 2, and 3 are activated as well as the total amount of time the robot has been active. The program keeps track of how many times each solenoid valve has been opened and for how long, it then multiplies this by the milliamp rating of the relay switches (discussed below) and adds this to the amount of power that has been consumed by the microcontroller. It then records how many cycles have been performed by the time the milliamp hours used exceeds the rating of the battery.

The life expectancy of the coin cell battery stack is calculated by using the number of times solenoid valves 1, 2, and 3. The program keeps track of how many times each solenoid valve has been opened and for how long, it then multiplies this by the milliamp rating of the solenoid valves. It then records how many cycles have been performed by the time the milliamp hours used exceeds the rating of the battery.

Under the conditions that the robot starts with a natural negative buoyancy of 1.6 lbs and inflate-deflate period of 2 hours (1 cycle every two hours) with a constant desired positive buoyancy of .5 pounds the MATLAB program yields the following expected life expectancies: 197.5 days worth of carbon dioxide, 21.4 days worth of solenoid (coin cell) power, and 16.6 days worth of microcontroller (9-volt) power.

 

Maximum Life Expectancy of Robot Power Supplies

Carbon Dioxide

197.5 Days

Coin Cell Battery Stack (Solenoid Valves)

21.4 Days

9-volt (microcontroller)

16.6 Days

Table 6.D.1

        These numbers are only approximate and assume ideal conditions in which the batteries and carbon dioxide tank exhaust completely. However it can be assumed to within a reasonable degree of certainty that the robot has sufficient power to last for approximately two weeks. If desired, this length of time can be easily increased to one month by wiring an additional 9-volt battery and coin cell battery stack into parallel with the existing batteries.


Home | Members | Summary | Background | Scope | Design Concepts | Final Design | Testing | Conclusions | Calculations | Parts List | Site Map

Last updated: 04/09/07.