Rookie need assistance learning

Hi,
I am retired and am attemting to build a device ran by an arduino. I'm on chemo and it seems to be effecting my abillity to grasp the concept of how these things word and are programmed. the following is what I am attempting to do.

Description: The automated cylinder honing machine (ACHM) consists of three motors that are independently operated using an Arduino Uno, AC voltage relay and required power supplies.

Motor #1: Reciprocating Cycle Linear Push Pull Motor Actuator 20MM-120MM DC12V/24V.

Motor #2: Rotating cylinder hone drive motor.

Motor #3: Lubricating oil pump.

Theory of Operation:

Motor #1 runs the reciprocating arm. The motor is to be variable speed to set the duration of the stroke. The strokes are to be counted by a circuit designed to count the Variably set number of strokes and preform two functions. One is to provide reoccurring lubrication and the second is to shut the main power source off when it reaches the second predetermined number of strokes.

Motor # 2 runs the cylinder hones. The motor is run in parallel with the output of the motor #1 variable power source and runs at the same speed and shuts off when the main power source is shut down.

Motor #3 is a time delayed lubricating fluid pump that will be activated for a set number of pumping actions that will deliver the desired amount of fluid at a repetitive rate until the main power source is shut down. I.e. every tenth stroke of pump #1 activates Motor #3 “the pump” for 2 strokes to lubricate the reciprocating, revolving cylinder hones. The counter will reset to 0 for the pumping circuit and repeat the sequence of events. The reciprocating counter will continue to reach 120 then shut down the main 120VAC power source via relay. Motor #3 circuitry will have a manual momentary on switch to be used to prime the pump.

Any and all assistance will be greatly appreciated.

Welcome to the forum

Your topic has been moved to the Project Guidance category of the forum as it is more relevant to your questions at this stage

That is an excellent start on a statement of requirements. Once you flesh it out, open a new sketch and paste all that in as comments. Now, start replacing the English with Arduino code. There will also be some code for infrastructure, but you will learn that when you look at sample code contained in the IDE for motor controls. I think you want to use stepper motors for this project, start with their samples for library AccelStepper.

It sounds like you have a working system, and want to update it. Unfortunately, the code used to run the Arduino is not the same as code used to program the Arduino.

For that reason, your detailed description will be needed to create a "state machine" program for the Arduino.

State machines and non-blocking routines (like "Blink Without Delay") are two programming techniques that will be used through all your Arduino programming.

https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay/

Chemo brain is disrupting my ability to comprehend. I'm looking for info on how to begin learning. someone has posted a didikey link that looks promising. I'm not lazy, just confused.

Having done cylinder honing several times in my life, You need to first concentrate on the physical construction of your machine. Does your machine compress the stone holders and insert them into the cylinder? How does your machine remove the honing mechanism at the end of the process?
Will your machine inspect the cylinder to determine if more time is needed?

Good luck with the chemo!

1 Like

I guess the best way is to ask this. I want it to count to 120. At every ten count turn on an led for two counts then off again and repeat the cycle until it gets to 120 then turn off a relay to the power supply that shuts off the whole thing. Can it do this is my question.

When "in the fog" I used a written list. I think you could use videos to do that (first watch, write the list. second watch, build-along). Your list of tasks is very involved. Maybe start with a video concerning programming a relay?

// https://forum.arduino.cc/t/rookie-need-assistance-learning/1286072/10

/*
  I want it to count to 120. At every ten count turn on an led for two counts
  then off again and repeat the cycle until it gets to 120 then turn off a 
  relay to the power supply that shuts off the whole thing. 
*/

byte ledPin = 2, relayPin = 3, powerPin = 4;
byte countTen = 10, countFinal = 120, twoCounter, finalCounter;
unsigned long interval = 1000; // ms between counts

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(powerPin, OUTPUT);
  digitalWrite(powerPin, HIGH);

  while (finalCounter < countFinal + 1) {
    if ((finalCounter > 2) && (!(finalCounter % countTen) || ((finalCounter % countTen) == 1))) {
      digitalWrite(relayPin, HIGH);
      digitalWrite(ledPin, HIGH);
    } else {
      digitalWrite(relayPin, LOW);
      digitalWrite(ledPin, LOW);
    }

    // Serial monitor output formating
    if (finalCounter < 100) Serial.print(" ");
    if (finalCounter < 10) Serial.print(" ");
    Serial.print(finalCounter);
    Serial.print(" ");
    if (!(finalCounter % 10)) Serial.println();
    finalCounter++;
    delay(interval);
  }

  // turn everything off at count 120
  digitalWrite(ledPin, LOW);
  digitalWrite(relayPin, LOW);
  digitalWrite(powerPin, LOW);
}

void loop() {}
diagram.json for wokwi.com
{
  "version": 1,
  "author": "Anonymous maker",
  "editor": "wokwi",
  "parts": [
    { "type": "wokwi-arduino-nano", "id": "nano", "top": 0, "left": 0, "attrs": {} },
    { "type": "wokwi-relay-module", "id": "relay1", "top": -105.4, "left": 134.4, "attrs": {} },
    {
      "type": "wokwi-led",
      "id": "led1",
      "top": -49.2,
      "left": 141,
      "rotate": 90,
      "attrs": { "color": "red" }
    },
    { "type": "wokwi-vcc", "id": "vcc1", "top": -258.44, "left": 115.2, "attrs": {} },
    { "type": "wokwi-relay-module", "id": "relay2", "top": -201.4, "left": 134.4, "attrs": {} },
    {
      "type": "wokwi-text",
      "id": "legendservo1",
      "top": -220.8,
      "left": 153.6,
      "attrs": { "text": "SYSTEM RELAY" }
    },
    {
      "type": "wokwi-text",
      "id": "legendservo2",
      "top": -124.8,
      "left": 153.6,
      "attrs": { "text": "MOTOR RELAY" }
    },
    {
      "type": "wokwi-led",
      "id": "led2",
      "top": -68,
      "left": 275.4,
      "rotate": 90,
      "attrs": { "color": "green", "flip": "1" }
    },
    {
      "type": "wokwi-text",
      "id": "legendservo3",
      "top": -48,
      "left": 316.8,
      "attrs": { "text": "MOTOR" }
    }
  ],
  "connections": [
    [ "nano:GND.2", "led1:C", "black", [ "v0" ] ],
    [ "nano:GND.2", "relay1:GND", "black", [ "v0" ] ],
    [ "nano:2", "led1:A", "green", [ "v0" ] ],
    [ "nano:3", "relay1:IN", "green", [ "v0" ] ],
    [ "vcc1:VCC", "relay2:COM", "red", [ "v9.6", "h144", "v49.4" ] ],
    [ "relay1:VCC", "relay2:NO", "red", [ "h-19.2", "v-48", "h153.6", "v-27" ] ],
    [ "vcc1:VCC", "relay1:COM", "red", [ "v9.6", "h163.2", "v57.6" ] ],
    [ "nano:GND.2", "led2:C", "black", [ "v0" ] ],
    [ "relay1:NO", "led2:A", "green", [ "h0" ] ],
    [ "nano:GND.2", "relay2:GND", "black", [ "v0" ] ],
    [ "nano:4", "relay2:IN", "green", [ "v0" ] ],
    [ "vcc1:VCC", "relay2:VCC", "red", [ "v0" ] ]
  ],
  "dependencies": {}
}

Yes

1 Like

Consider the interval of the count. One second between counts, one minute, and so on.

Yes, that is basic procedural coding.

I wrote some code for a cylinder honing system for someone here a while back. I don’t believe it was as complex as your requirement. I’ll try to dig it out when I’m not on my phone.

So far so good. The fog is starting to lift. I guess I just needed to know the correct terminology to find the instructions I needed. The videos were a great help! Thanks! I'm not there yet but rowing a boat is a lot easiert when you have oars.

Here's the thread Honing cylinders

Lots of evolving versions of the code there for you to peruse.

Hey wildbill it's been awhile since project hone cylinders, When Covid hit things kinda went sideways had it 3 times even after several rounds of of the so called inoculations. Anyway project hone got tabled after that. [jpl6715] take a look at the outstanding coding willbill did on that and use it anyway you can, Good luck

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.