Alimentation lampes calibration

Design, construction, tuning of spectroscopes
Information and discussion about softwares (telescope remote, autoguiding, acquisition, spectral processing ...)
Post Reply
Francois Teyssier
Posts: 1521
Joined: Fri Sep 23, 2011 1:01 pm
Location: Rouen
Contact:

Alimentation lampes calibration

Post by Francois Teyssier »

Voici mon module d"alimentation pour les lampes de calibration d'un spectrographe echelle (NOUT):
nout_alim.jpg
nout_alim.jpg (240.78 KiB) Viewed 2190 times
Une alim 220 V --> 5 et 12 V
Une carte Arduino uno
Un module de 4 relais

Le sketch Arduino:


const int analogPinSol = 2;//Solenoid
const int analogPinRelco = 3; //Relco
const int analogPinTung = 4; // Tunsten
const int analogPinLed = 5;

int incomingByte; // a variable to read incoming serial data from processing

void setup() {
// initialize serial communication:
Serial.begin(9600);
// initialize the pin as outputs:
pinMode(analogPinSol, OUTPUT);
pinMode(analogPinRelco, OUTPUT);
pinMode(analogPinLed, OUTPUT);
pinMode(analogPinTung, OUTPUT);

digitalWrite(analogPinSol, LOW);
digitalWrite(analogPinRelco, LOW);
digitalWrite(analogPinTung, LOW);
digitalWrite(analogPinLed, LOW);
}

void loop() {

if (Serial.available() > 0) {
incomingByte = Serial.read();

// send orders to Arduino Uno from the order sent by Processing sketch

if (incomingByte == 'A') {
digitalWrite(analogPinSol, HIGH);
digitalWrite(analogPinRelco, HIGH);
}
if (incomingByte == 'B') {
digitalWrite(analogPinSol, HIGH);
digitalWrite(analogPinTung, HIGH);
}
if (incomingByte == 'C') {
digitalWrite(analogPinSol, LOW);
digitalWrite(analogPinLed, HIGH);
}
if (incomingByte == 'L') {
digitalWrite(analogPinSol, LOW);
digitalWrite(analogPinRelco, LOW);
digitalWrite(analogPinLed, LOW);
digitalWrite(analogPinTung, LOW);

}
}
}

Pour la commande, j'ai utilisé Processing (https://processing.org/)

Interface graphique:

NOUT_Commandes.png
NOUT_Commandes.png (5.36 KiB) Viewed 2192 times
Sketch Processing:

import processing.serial.*;

float boxX;
float boxY;
int boxSize = 20;
int Xbox = 80;
int Ybox =40;
int dX1 = 100;
int dX2 = 200;
int dX3 = 300;
int dY1 = 50;
int dY2 = 100;
int dY3 = 150;
int alertTung = 120;
int t0;
int t1;
int duree;
boolean Relco = false;
boolean Led = false;
boolean Tung = false;

color vert =color(0,255,0);
color rouge =color(255,0,0);
color bleu = color(0,0,255);
color gris =color(100,100,100);
color grisclair = color(200,200,200);
color blanc =color(255,255,255);
boolean mouseOverBox = false;

Serial port;

void setup() {
size(400, 200);
boxX = width / 2.0;
boxY = height / 2.0;
rectMode(RADIUS);


println(Serial.list());
port = new Serial(this, Serial.list()[2], 9600);

background(200,200,200);
rectMode(CENTER);

fill(bleu);
text("ON", 20,55);
text("OFF", 20,105);
text("Relco", dX1-Xbox/2, 20);
text("Tung", dX2-Xbox/2, 20);
text("Led", dX3-Xbox/2, 20);

fill(gris);
rect(dX1, dY1, Xbox, Ybox);
fill(gris);
rect(dX2, dY1, Xbox, Ybox);
fill(gris);
rect(dX3, dY1, Xbox, Ybox);

fill(blanc);
rect(dX1, dY3, Xbox, Ybox/2);
fill(blanc);
rect(dX2, dY3, Xbox, Ybox/2);
fill(blanc);
rect(dX3, dY3, Xbox, Ybox/2);

fill(rouge);
rect(dX1, dY2, Xbox, Ybox);
fill(rouge);
rect(dX2, dY2, Xbox, Ybox);
fill(rouge);
rect(dX3, dY2, Xbox, Ybox);

}

void draw() {
int h = hour();
int m = minute();
int s = second();
textSize(14);

delay(100);

// 1. Relco

if (mouseX > dX1 - Xbox/2 && mouseX < dX1 + Xbox/2 &&
mouseY > dY1 - Ybox/2 && mouseY < dY1 + Ybox/2 && mousePressed && Led == false && Relco == false && Tung == false) {
Relco = true;
fill(vert);
rect(dX1, dY1, Xbox, Ybox);
fill(gris);
rect(dX1, dY2, Xbox, Ybox);
port.write('A');
t0 = second()+minute()*60+hour()*3600;
}

if (mouseX > dX1 - Xbox/2 && mouseX < dX1 + Xbox/2 &&
mouseY > dY2 - Ybox/2 && mouseY < dY2 + Ybox/2 && mousePressed && Relco == true) {
Relco = false;
fill(rouge);
rect(dX1, dY2, Xbox, Ybox);
fill(gris);
rect(dX1, dY1, Xbox, Ybox);
port.write('L');

fill(blanc);
rect(dX1, dY3, Xbox, Ybox/2);
}

if (Relco == true){
fill(blanc);
rect(dX1, dY3, Xbox, Ybox/2);
t1 = h*3600+m*60+s;
duree = t1 - t0;
fill(0,0,255);
text(duree + " s", dX1-5, dY3+5);
}

// 2. Tung

if (mouseX > dX2 - Xbox/2 && mouseX < dX2 + Xbox/2 &&
mouseY > dY1 - Ybox/2 && mouseY < dY1 + Ybox/2 && mousePressed && Led == false && Relco == false && Tung == false) {
Tung = true;
fill(vert);
rect(dX2, dY1, Xbox, Ybox);
fill(gris);
rect(dX2, dY2, Xbox, Ybox);
port.write('B');
t0 = second()+minute()*60+hour()*3600;
}

if (mouseX > dX2 - Xbox/2 && mouseX < dX2 + Xbox/2 &&
mouseY > dY2 - Ybox/2 && mouseY < dY2 + Ybox/2 && mousePressed && Tung == true) {
Tung = false;
fill(rouge);
rect(dX2, dY2, Xbox, Ybox);
fill(gris);
rect(dX2, dY1, Xbox, Ybox);
port.write('L');

fill(blanc);
rect(dX2, dY3, Xbox, Ybox/2);
}


if (Tung == true){
fill(blanc);
rect(dX2, dY3, Xbox, Ybox/2);
t1 = h*3600+m*60+s;
duree = t1 - t0;
fill(0,0,255);
text(duree + " s", dX2-5, dY3+5);
}

// 3. LED

if (mouseX > dX3 - Xbox/2 && mouseX < dX3 + Xbox/2 &&
mouseY > dY1 - Ybox/2 && mouseY < dY1 + Ybox/2 && mousePressed && Led == false && Relco == false && Tung == false) {
Led = true;
fill(vert);
rect(dX3, dY1, Xbox, Ybox);
fill(gris);
rect(dX3, dY2, Xbox, Ybox);
port.write('C');
t0 = second()+minute()*60+hour()*3600;
}

if (mouseX > dX3 - Xbox/2 && mouseX < dX3 + Xbox/2 &&
mouseY > dY2 - Ybox/2 && mouseY < dY2 + Ybox/2 && mousePressed && Led == true) {
Led = false;
fill(rouge);
rect(dX3, dY2, Xbox, Ybox);
fill(gris);
rect(dX3, dY1, Xbox, Ybox);
port.write('L');

fill(blanc);
rect(dX3, dY3, Xbox, Ybox/2);
fill(grisclair);
noStroke();
rect(dX3, dY3+30, Xbox, Ybox-5);

}


if (Led == true){
fill(blanc);
rect(dX3, dY3, Xbox, Ybox/2);
t1 = h*3600+m*60+s;
duree = t1 - t0;
fill(0,0,255);
text(duree + " s", dX3-5, dY3+5);
if (duree > alertTung){
fill(255,0,0);
text("Durée Max", dX3-35, dY3+30);
Tung = false;
fill(rouge);
rect(dX3, dY2, Xbox, Ybox);
fill(gris);
rect(dX3, dY1, Xbox, Ybox);
port.write('L');

fill(blanc);
rect(dX3, dY3, Xbox, Ybox/2);
fill(grisclair);
noStroke();
rect(dX3, dY3+30, Xbox, Ybox-5);
}
}
}
Olivier GARDE
Posts: 1245
Joined: Thu Sep 29, 2011 6:35 am
Location: Rhône Alpes FRANCE
Contact:

Re: Alimentation lampes calibration

Post by Olivier GARDE »

Super comme réalisation François !!!
Cela peut être décliné pour n'importe quel commande de lampe de calibration.

Merci pour le partage.
LHIRES III #5, LISA, e-Shel, C14, RC400 Astrosib, AP1600
http://o.garde.free.fr/astro/Spectro1/Bienvenue.html
Joan Guarro Flo
Posts: 620
Joined: Thu Nov 03, 2011 8:50 pm

Re: Alimentation lampes calibration

Post by Joan Guarro Flo »

Bonjour François,

Many thanks for that for your job, that is a useful tool for the NOU_T echelle spectrograph, and as Olivier said for a lot of other ones.
Really we needed this device and software.

Amicalement, Joan.
Michel Verlinden
Posts: 191
Joined: Tue Aug 16, 2016 12:11 am

Re: Alimentation lampes calibration

Post by Michel Verlinden »

Félicitations François,
Superbe réalisation !
Michel VERLINDEN
Matthieu Le Lain
Posts: 24
Joined: Mon Apr 15, 2019 4:33 pm

Re: Alimentation lampes calibration

Post by Matthieu Le Lain »

Belle réalisation, vraiment intéressant !

Merci pour le partage François

Matthieu
Post Reply