Pc Lap Counter
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Pc Lap Counter

Logiciel de comptage
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  

 

 Zwiebelring - 4x20m - DS300, Arduino, external button and external lights

Go down 
2 posters
AuthorMessage
Zwiebelring

Zwiebelring


Number of posts : 50
Localisation : près de Francfort sur le Main en Allemagne
Registration date : 2006-05-23

Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Empty
PostSubject: Zwiebelring - 4x20m - DS300, Arduino, external button and external lights   Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Empty27/1/2021, 17:17

This is to show my track and to explain a bit how the bits and pieces are connected. Maybe it is also a little bit of help for others like me, who are not really experts in electronics.

First - my track is the same as my nickname. Both are related to the country and town I'm living in. This town is Griesheim - near Frankfurt - which is a little bit famous for the "production" of onions. So the direct meaning of Zwiebelring in German is "onion ring". But ring has also a second meaning in German - it is quite often used also as synonym of circuit or track. Here we go - it's a pun ...

So the Zwiebelring is my four lane home track. Lap counting is done by PCLC (of course). The sensor for lap detection is a DS300. There is an external set of starting lights powered by 12V.
Using an external button the race can be paused and the power is switched off. In this case also all five lights blink.  
External button, power and lights had been connected by parallel port before. This has been changed by squeezing in an Arduino recently. This means the output of the Arduino is put on a parallel connector and the rest afterwards still can be used as it was before with the parallel interface.
The parallel cable connects my Arduino box with a relay card, which on one side actually switches on and off the lights and on the other side is connected by a single cable to another relay box containing a single relay for power control of all four lanes.


Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Zwiebe10

Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Zr-pan10

You can see the whole setup in action here

https://www.amazon.de/clouddrive/share/I3ufg6gEgNUMCeOoxh0XAGBb58bwZfbLfr14iQeKNgd

My Arduino sketch looks as follows:

Code:

// Pclapcounter & Arduino
// sketch for 4 lanes
//   5 lights
//   power control
//   external pause button
// Author: Zwiebelring
//
// Lights:       OutputPins 6-5-4-3-2
// Power:        OutputPin 7  
// Pause Button: InputPin 12

int LIGHT5 = 2;
int LIGHT4 = 3;
int LIGHT3 = 4;
int LIGHT2 = 5;
int LIGHT1 = 6;

int PWR = 7;

int NEXT = 12;
int NEXTstatus = 0;
int NEXTflag = 0;
int LED = 13;
unsigned long T1;
unsigned long NEXTinhibit = 1000; // minimum time between first button pressed and next

void setup() {
  Serial.begin(9600);  
  pinMode(NEXT, INPUT); //pause button
  pinMode(LED, OUTPUT);
  pinMode(LIGHT1, OUTPUT);
  pinMode(LIGHT2, OUTPUT);
  pinMode(LIGHT3, OUTPUT);
  pinMode(LIGHT4, OUTPUT);
  pinMode(LIGHT5, OUTPUT);
  pinMode(PWR, OUTPUT); //power
  
  digitalWrite(LIGHT1, LOW);
  digitalWrite(LIGHT2, LOW);
  digitalWrite(LIGHT3, LOW);
  digitalWrite(LIGHT4, LOW);
  digitalWrite(LIGHT5, LOW);

  digitalWrite(PWR, LOW);

  T1 = millis();
}

void loop() {
  unsigned long currentMillis;
  String DUMMY;
  String CMD;
  
  NEXTstatus = digitalRead(NEXT);
  currentMillis = millis();
  delay(10); // to reduce traffic a bit, maybe not necessary

  if ((NEXTflag == 1) && ((currentMillis-T1)>NEXTinhibit)){
    NEXTflag = 0;
  }  
  
  if ( (NEXTstatus == 1) && (NEXTflag == 0) ) {
    NEXTflag = 1;
    Serial.println("[BT04]");
    T1 = millis();
  }
  
  if ( Serial.available() )
 {

  DUMMY = Serial.readStringUntil('[');
  CMD = Serial.readStringUntil(']');

  //power control
  if ( CMD == "PW000" ) { digitalWrite(PWR, LOW);  }
  if ( CMD == "PW001" ) { digitalWrite(PWR, HIGH); }

  //Starting and blinking lights
  if ( CMD == "SL010" ) { digitalWrite(LIGHT1, LOW);  }
  if ( CMD == "SL011" ) { digitalWrite(LIGHT1, HIGH); }
  
  if ( CMD == "SL020" ) { digitalWrite(LIGHT2, LOW);  }
  if ( CMD == "SL021" ) { digitalWrite(LIGHT2, HIGH); }

  if ( CMD == "SL030" ) { digitalWrite(LIGHT3, LOW);  }
  if ( CMD == "SL031" ) { digitalWrite(LIGHT3, HIGH); }

  if ( CMD == "SL040" ) { digitalWrite(LIGHT4, LOW);  }
  if ( CMD == "SL041" ) { digitalWrite(LIGHT4, HIGH); }

  if ( CMD == "SL050" ) { digitalWrite(LIGHT5, LOW);  }
  if ( CMD == "SL051" ) { digitalWrite(LIGHT5, HIGH); }
  
 }  //   if ( Serial.available() )
  
}

Kind regards

Gerald

GER_1967er likes this post

Back to top Go down
http://www.zwiebelring.net
GER_1967er




Number of posts : 1
Registration date : 2021-03-12

Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Empty
PostSubject: Re: Zwiebelring - 4x20m - DS300, Arduino, external button and external lights   Zwiebelring - 4x20m - DS300, Arduino, external button and external lights Empty12/3/2021, 14:53

Hello Gerald,

this looks very interesting, I would be interested in the wiring here.

Greetings from Southwest Germany
Jürgen
Back to top Go down
 
Zwiebelring - 4x20m - DS300, Arduino, external button and external lights
Back to top 
Page 1 of 1
 Similar topics
-
» Schema to connect external button to phidget
» Starting Lights and yellow flag
» External Start Lights
» Video of working external lights
» RDM6300 via Arduino - Example Wiring (Arduino Code to follow)

Permissions in this forum:You cannot reply to topics in this forum
Pc Lap Counter :: Pictures-
Jump to: