Introduction: Cut-Away 4-Stroke Engine

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

Step 1: Download and Print All the Parts

See image for description of each part and quantity

Attachments

Step 2: Wire Up a Breadboard or Solder Up a Perf-board

You will need to solder wires to the ends of the legs of the spark plug LED and RGB LED. These wires need to be about 12" long.

Note that VCC will need to be hooked up to a 7-12 Volt power source. I used a 12V battery. This worked well with a standard 9V but the battery will not last long.

Step 3: Upload Sketch to Arduino

#include

#include

// Define the stepper and the pins it will use AccelStepper stepper1(AccelStepper::DRIVER, 9, 8); LiquidCrystal_I2C myDisplay(0x27, 16, 2);

int CMP = 12; //Switch used to home stepper

// LED's int red = 3; int green = 5; int blue = 6; int SPARK = 11;

// Variables int pos; int oneRev; float RPM;

long initial_homing = 1;

// Define our analog pot input pin #define SPEED_PIN 0

// Define our maximum and minimum speed in steps per second (scale pot to these) #define MAX_SPEED 5000 #define MIN_SPEED 100

void setup() {

Serial.begin(9600); // Start the Serial monitor with speed of 9600 Bauds delay(5); // The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go stepper1.setMaxSpeed(1000.0); stepper1.setAcceleration(100.0); // Set Acceleration of Stepper // Setting up Display.

myDisplay.init(); //initialize the lcd - this sets the character canvas to 5x8 pixels and some other hardware specifics //Note: This .init() method also starts the I2C bus, i.e. there does not need to be //a separate "Wire.begin();" statement in the setup.

myDisplay.backlight();//this turns the backlight on myDisplay.setCursor(0, 1); myDisplay.print("Starting");

pinMode(CMP, INPUT_PULLUP); pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); pinMode(SPARK, OUTPUT); oneRev = 1600; // Steps per revolution

// Start Homing procedure of Stepper Motor at startup

Serial.print("Stepper is Homing . . . . . . . . . . . ");

while (digitalRead(CMP)) { // Make the Stepper move CCW until the switch is activated stepper1.moveTo(initial_homing); // Set the position to move to initial_homing++; // Decrease by 1 for next move if needed stepper1.run(); // Start moving the stepper delay(5); }

stepper1.setCurrentPosition(0); // Set the current position as zero for now stepper1.setMaxSpeed(100.0); // Set Max Speed of Stepper (Slower to get better accuracy) stepper1.setAcceleration(100.0); // Set Acceleration of Stepper initial_homing = 1;

while (!digitalRead(CMP)) { // Make the Stepper move CCW until the switch is deactivated stepper1.moveTo(initial_homing); stepper1.run(); initial_homing++; delay(5); }

stepper1.setCurrentPosition(0); Serial.println("Homing Completed"); Serial.println(""); stepper1.setMaxSpeed(10000.0); // Set Max Speed of Stepper (Faster for regular movements) stepper1.setAcceleration(1000.0); // Set Acceleration of Stepper

myDisplay.setCursor(0, 1); myDisplay.print(" "); myDisplay.setCursor(0, 1); myDisplay.print("RPM"); }

void loop() { static float current_speed = 0.0; // Holds current motor speed in steps/second static int analog_read_counter = 3000; // Counts down to 0 to fire analog read static char sign = 1; // Holds -1, 1 or 0 to turn the motor on/off and control direction static int analog_value = 0; // Holds raw analog value.

// We only want to read the pot every so often (because it takes a long time we don't // want to do it every time through the main loop). if (analog_read_counter > 0) { analog_read_counter--; } else { //Turn off all LED's digitalWrite(red, LOW); digitalWrite(blue, LOW); digitalWrite(green, LOW); digitalWrite(SPARK, LOW); analog_read_counter = 3000; // Now read the pot (from 0 to 1023) analog_value = analogRead(SPEED_PIN); // Give the stepper a chance to step if it needs to stepper1.runSpeed(); // And scale the pot's value from min to max speeds current_speed = sign * (((analog_value / 1023.0) * (MAX_SPEED - MIN_SPEED)) + MIN_SPEED); // Update the stepper to run at this new speed stepper1.setSpeed(current_speed);

// Reset position each revolution pos = stepper1.currentPosition() * 360 / oneRev; if (pos > 720) { stepper1.setCurrentPosition(0); }

//Display RPM RPM = current_speed / 20; myDisplay.setCursor(5, 1); myDisplay.print(RPM); //Serial.println(RPM);

// //Combustion process if (pos > 0 && pos < 180) { digitalWrite(blue, HIGH); myDisplay.setCursor(0, 0); myDisplay.print("Intake "); Serial.println("Intake");

} if (pos > 180 && pos < 360) { digitalWrite(red, HIGH); digitalWrite(green, HIGH); myDisplay.setCursor(0, 0); myDisplay.print("Compression "); //Serial.println("Compression");

} if (pos > 340 && pos < 380) { digitalWrite(SPARK, HIGH); } if (pos > 360 && pos < 540) { digitalWrite(red, HIGH); myDisplay.setCursor(0, 0); myDisplay.print("Combustion "); //Serial.print("Combustion");

} if (pos > 540 && pos < 719) { digitalWrite(green, HIGH); myDisplay.setCursor(0, 0); myDisplay.print("Exhaust "); //Serial.println("Exhaust");

} }

// This will run the stepper at a constant speed stepper1.runSpeed();

}

Step 4: File and Sand Components

Tolerances must be precise and turn freely with little play. This will require some sanding and filing of most of the components to fit properly. Test each piece as you go.

Step 5: Assemble Gear-train

Start with the Back bracket, Install the cam gear, camshaft, crank gear, crank half, and Idler gear in the orientation shown in the image. Note that if this is done wrong damage can occur when running the engine. Make sure all of these gears are lubricated and turn freely.

Step 6: Assemble the Rest of the Components.

Install the crank pin, connecting rod. Next slide the Cylinder into the dovetail in the back bracket until the bottom is flush. Next insert the piston into the cylinder and install the wrist pin into the piston to connect it to the connecting rod. Then install the other crank half and front crank bracket and bolt both brackets to the lid. Once you have done this, align both crank halves and add a drop of superglue to the crank pin and crank halves to prevent them from coming out of phase.

Press the stepper gear onto the shaft of the stepper motor and bolt onto the lid. Using hot glue, install the LCD screen and rotary pot onto the lid. Insert valves into cylinder head and install 3/8" x 3/4" compression springs over valve. Add a drop of glue to each keeper and while holding the spring compressed, place keeper over valve and hold in place until glue dries.

Next place the RGB LED into the back hole on the cylinder head while keeping the legs of the RGB LED apart. Use hot glue to secure this in place and as an insulator for the legs of the RGB LED.

Install both rockers onto cylinder head.

Slide cylinder head into dovetail of crank bracket until the bottom touches the top of the cylinder.

Drop in the lifters into the guides on the side of the cylinder and install push rods by compressing the valve spring and lifting the rockers up. These should pop into place.

Finally, install the spark plug into the hole and connect all the wires.

Step 7: Connect a Power Source and Enjoy!