Pages: [1] 2   Go Down
Author Topic: :) Help getting started with Arduino in Paintball gun :)  (Read 681 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys this is my first post, woot!  Anyway I am trying to program a Arduino Nano to operate my paintball marker.  This gun operates a 5v solenoid to fire the gun.  There is also a led and photo tranistor to detect a paintball in the breech.  If the beam of light is broken, a paintball is in the chamber and the bolt should be allowed to move forward.  If there is not a paintball in the breech then the light will hit the phototranistor and the bolt will not be allowed to move forward.  For the solenoid, It need to cycle and stay open for about 15-20 millisecond (dwell time).  I do have plans to add a LCD screen eventually and some other fun extras but for now I need help writing the basic code to get the gun to function correctly.  Some other settings will be rate of fire, semi,full auto, and ramping (3-4 shots semi then the gun shoots at a constant rate as long as I pull the trigger every second or so).  Please anyone with good advice guide me in the general direction and help me with my first Arduino project!  I am an engineering student in my 3rd year of college and soon we will build junior and senior design projects using the Arduino so learning how to programs these now will help me out greatly on my future projects.

Thanks, Kevin


« Last Edit: September 27, 2013, 07:20:50 pm by fspro2006 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

check out the arduino paintball sentry gun on google.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

would I have to disect the code of the sentry gun to get the controls I want?  I only need to control the solenoid with the led detectors and micro switch for the trigger.  Sentry gun does way more than that lol, it has infared trackers and 3 servo motors and more features than I need.
Logged

0
Offline Offline
Tesla Member
***
Karma: 116
Posts: 8942
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could externally mount a servo to pull the trigger, then the gun wouldn't need to be seriously hacked.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to hold and shoot the gun like I normally would though, I want to know how to get started on coding to control the solenoid based off what the led sensors detect when the trigger is pulled, and add some more settings for a cap on the rate of fire.  I'm not trying to build a sentry type paintball gun.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes this will be my first Arduino project, very excited.  I have only typed up a handful of simple functions and scripts on matlab for engineering class.  Do not know where to start with my project.
          I am trying to put an Adruino Nano Inside my paintball gun to replace the old outdated circuit board.  The Arduino needs to control a 5v solenoid based off of if the 2 led "eye" sensors detect a paintball when the trigger is pulled.  to make everything simple and to get the gun shooting I want semi only, rate of fire, and dwell time for the solenoid.  Where do I start with typing the codes?  
            If a paintball is not all the way in the breech the led light is detected by the photo transistor and if the trigger is pulled the solenoid will NOT fire.  If a paintball is in the breech then the photo transistor will not detect light and if the trigger is pulled the gun WILL fire.
« Last Edit: September 27, 2013, 07:20:35 pm by fspro2006 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46113
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the Programming forum. Where is your code?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Remove the link to "free screenshot software" or be banned for spamming.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

- Moderator
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

removed, didn't know that was a problem, or even there for that matter..just copy and pasted from the website I use to upload.  first day on this forum.. give me a chance to figure things out...my apologies 
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Welcome to the forum.

Quote
Where do I start with typing the codes? 

I suggest working your way through some of the examples, trying each one out. You will then feel more confident in tackling a larger project.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

went through a couple of them and started tryping the code to operate the solenoid.  used boolean running to send high to solenoid pin 5 when micro switch pin 7   here is what I have so far:

int solenoidpin = 5; // initalize pin 5 for solenoid
  int triggerswitchpin = 7;  // intialize pin 7 for trigger switch
  boolean running = false;
  

void setup(){
  pinMode (solenoidpin, OUTPUT);  //output voltage to solenoid
  pinMode(triggerswitchpin,INPUT); //input voltage from trigger switch
  digitalWrite(triggerswitchpin,HIGH); //input reads high when trigger is pulled
  }

void loop()
{
  if (digitalRead(triggerswitchpin) == HIGH)
  {//trigger is puled - pullup keep pin low normally
  delay(1000);        //delay to debounce switch
  running = !running;    //toggle running variable
  digitalWrite(solenoidpin,running);   //sends signal to solenoid
  delay (14); //dwell time for solenoid
  }
}
Logged

0
Offline Offline
Tesla Member
***
Karma: 116
Posts: 8942
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Basic button "do something" code, in this case, control a servo, but could control a solenoid and such.

Code:
//zoomkat servo button test 7-30-2011

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(160);
  }
  else {
    servo1.write(20);
  }
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What marker are you trying to replace the board in?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Zoocat, thanks, would I just replace servo with solenoid in the code? could you attach some more comments?

What marker are you trying to replace the board in?
Its a 2006 ICD Freestyle Pro, spool valve controlled by solenoid
Logged

Pages: [1] 2   Go Up
Jump to: