Laser Scanning Display Project - Electronics Forums

Author Topic: Laser Scanning Display Project  (Read 30863 times)

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #30 on: May 13, 2013, 04:11:09 PM »
Hi ElektroNick, I am just frustrated! The motor is now rotating with a IFFIZ24N (good news).
But I am trying the whole day to make CNY70 working (reflector photoresistor). Somehow it is not working... the signal of the CNY37 has a very strange form, like a base sinus line is under it and the Laser on signal has the form, although coming directly out of the Arduino!
By writing the powersupply comes to my mind. With a risistance  of 2.4Ohm for each winding, makes at 9V nearly 4A! But mine has only 2.2A, maybe that makes it so confusing...
Did you check the dimensions of my ring for your situation? Does it fit? So I can order it ...

Electronics Forums

Re: Laser Scanning Display Project
« Reply #30 on: May 13, 2013, 04:11:09 PM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #31 on: May 13, 2013, 05:39:48 PM »
I've not yet used a reflective sensor like the CNY70. From its datasheet, the response is sensitive to the target distance - could it be that the sensor is either too close or too far from the mirrors? Also, speaking of mirrors, what if the mirrors are somehow messing up with the reflections that the phototransistor is registering? Is it located under the mirror disk or looking at the mirrors?

I have constructed another holder with the hopes of being able to adjust the mirror positions with set screws. Haven't done much work on it yet but I'm hopeful. In that holder, I also could not use the old U-shaped interrupter. So, I will be using a small magnet and a Hall-effect sensor, not an optical sensor, to sync rotations. I'll be posting more updates on that.

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #32 on: June 05, 2013, 04:50:57 PM »
Dear ElectroNick,

now I got the parts. the accuracy is perfect - but..! But the surface is not polished enough. The spot on the wall has a diameter of 5cm!
I will buy a polish wheel and polish the surfaces. Hopefully the surface stays plan! It is possible to polish Aluminium like a mirror ... (if you want the ring, send me your adress!)

I also solved the issue with the CNY70. A black mark on the disk results now in a signal for the interrupt.

Only the circuit for the HDD-motor does not work anymore. Drive me nuts!  I did use the IRFIZ 24N N-Mosfet last time and it worked. Now I built the circuit again, but the MOSFET gets very hot! I smelt the heat already ... and cannot find the mistake on my breadboard!

Any news on your side?

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #33 on: June 05, 2013, 05:10:46 PM »
Thank you for the update, Georg! I did not have too much time to put into the project lately due to increased workload at work. But before I had to take a break from it, I did try a different direction. I tried to cobble together a mirror holder with each mirror individually adjusted. I might have completely over-engineered it and, given that it's made of plastic (orange juice bottle cap) it is not very rigid. But it does draw pretty darn distinctive 12 red lines if I keep the laser on. See the picture.

Problem with that of course is the 12 mirrors - the software only recognized 8  so far.  It's already a very tight timing as it is with 8, I'm not sure 12 is even possible. So, because of the impending software change, I had to take a break from the project for a while. I'm still planning to finish it of course, just need some time to adjust.

I will keep you posted. I may take you up on your offer to make the 8-surface ring later, need to see if I can draw any cohesive output at all first.

Cheers!

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #34 on: June 07, 2013, 09:00:46 AM »
Your holder is looking good!
I finally find my mistake. but I do not come over 500 rpm. In the picture it looks like you made a new circuit for the HDD-motor? ( I still used that one, you proposed on April 17).

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #35 on: June 07, 2013, 09:50:48 AM »
Hi Georg,

Yes, good eye! It is a different driver circuit. Unfortunately it is not yet working to my satisfaction. I found it very difficult to get the larger 3.5" HDD motor started with the original spin up circuit. Probably because I am trying to power the entire project from a +5V power supply and that's a bit too little for the larger motor. I had no issues starting the smaller 2.5" HDD. Anyway, I am finding that it's a bit too much fork for the Arduino to keep track of the timing to do both the motor control and the laser flashes. I may have to do something of a hybrid - start spinning the motor with Arduino and then, when it gets going, let the independent spin-up circuit take over. That was yet another complication that made the progress in the project so slow.

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #36 on: June 18, 2013, 06:07:15 AM »
Dear ElektroNick, our longterm project will keep us busy for some time  :) I received my buff wheel last week. I just tried the first mirror. works good. Now I have to polish the other 7 sides - then my mirror ring will be ok!
My next step is to bring the HDD motor to speed ...
I agree with you it is time ciritical - eventually we just need 2 Arduino to handle it.

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #37 on: October 24, 2013, 04:36:16 PM »
Hi EltectoNick,
how are you doing?
I have some time now and started today again on our project. I am using an ESC. I followed an article about arduino and brushless motors including code http://kersevanivan.org/?cat=30 (sorry in German!). By accident I tried it with my old harddiskmotor, which has only 3 wires to the motor. And it runs!!! You can see the 6 lines on the wall. Now we can try to pulse the laser ...
How is our staff going on?
Bye

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #38 on: October 24, 2013, 06:46:43 PM »
Hi Georg,

I'm still here  but the project has been sitting on my workbench for months how, undisturbed :) It is nice to see your throwing 6 evenly spread lines! Looks like you're half way there then - I was never able to create a holder with mirrors truly evenly inclined. I have not given up on the project, however, just waiting for some free time to pick up where I left off.

Have you decided to go for 6 and not 8 lines? This may actually be very helpful to ease the load on the Arduino - it looks like it is not fast enough to process the pulses for 8 lines, or so it looked last time I played with the project.

As far as flashing the laser diode: you might want to get yourself a cheaper diode for testing. It will probably be red and come from a DVD-RW drive. I have noticed that "normal" laser diode driver are not able to pulse fast enough for our project (pulses of only a few microsecond width  may be required) and so in my last attempts to show some characters on the wall I ended up driving laser diode like a simple LED - with only a current limiting resistor (I am using regulated 5V voltage source). It is rather dangerous for the laser diode (though works a treat), that's why I'm saying get a cheaper one (or a dozen) in case it burns out.

I'll be posting updates here as I go along but don't have a definitive time line yet. I would appreciate if you post update here as well.

Cheers!

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #39 on: October 25, 2013, 01:57:27 AM »
oops: there are 8 mirrors but only 6 lines! I have to check my drawing...

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #40 on: October 25, 2013, 12:40:06 PM »
The text is running away...
?!?
Do you see a mistake in the code?? or an Idea what I can test??
I did use your code with the addons for the ESC.
Speed is around 130.000 microseconds/rotation. The sensor for the rotation is a CNY70 (Optic sensor).
Code: [Select]
/*
Laser Scanning Display Project
See http://elabz.com/ for more project details and instructions
 */
//#include <avr/pgmspace.h>
#include <TimerOne.h>

//byte slotPin = 2;
byte pwmsender = 10;
byte ledPin = 13;
byte laserOnPin = 4;
//byte potPin = 0;
int pwm;
int serialDelay = 5000; // print out RPM valule every 2 sec
unsigned long serialPeriodNow;
unsigned long rotationTime;
unsigned long lastInterrupt;
unsigned int rpm; // caclulated RPM value
byte currentRow = 0;
byte charsInLine = 4;
byte timePixel = 20; // this is in microseconds
int timeDelay = 20; // in microseconds - delay until the first pixel of the first column is shown
byte image[4][8]  = {
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000},
{B11111111,B11000001,B11000000,B11111000,B11111000,B11000000,B11000001,B11111111},
{B01111111,B11000001,B11000000,B01111100,B00111110,B00000011,B10000011,B11111110},
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000}
};

const byte rotatPin=7;
const int fanspeedoffset = 52;
char buffer[3];
int fanspeed = 0;
int i=0;
boolean isfanspeedcomplete=false;
int test;
int rot;
int duty;

void setup() {
  attachInterrupt(0, calcRPM, FALLING);
  Serial.begin(9600);
  pinMode(pwmsender, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(laserOnPin, OUTPUT);

  Timer1.initialize(20000);
  Timer1.pwm(pwmsender,52);

}

void loop() {

 int reading = digitalRead(rotatPin);   
 digitalWrite(ledPin,reading);

 if(Serial.available()>0 )
    {processFanSpeedMessage();}
 if(isfanspeedcomplete)
    {setPWMRate();
    isfanspeedcomplete=false;}
   

 if((millis() - serialPeriodNow) > serialDelay)
  {
   Serial.print("RT: ");
   Serial.print(rotationTime);
   Serial.print(" | Duty: ");
   Serial.println(duty);
   serialPeriodNow=millis();
  }

}


void calcRPM(){
  rotationTime = micros()-lastInterrupt;
  lastInterrupt = micros();
  byte currentCharRowByte;
  byte actualRow; // since the slot photointerruptor is on the side opposite to the laser, it's always 4 mirrors ahead
  actualRow = currentRow+4;
  if(actualRow > 7) actualRow=actualRow-8;
  int timeOneMirror = rotationTime/8;
  //delayMicroseconds(timeDelay); // small delay to align the laser with desired position on the wall (higher - string starts more to the left)
  delayMicroseconds(timeOneMirror*actualRow); // wait until the proper mirror for that row is positioned for the laser
  for(int x=0; x<charsInLine; x++){
    //currentCharRowByte = pgm_read_byte(&(image[x][currentRow]));
    currentCharRowByte =image[x][currentRow];
    for(int y=1; y<9; y++){
    if (currentCharRowByte & (1<<y)) {
        digitalWrite(laserOnPin, HIGH );
    }
      else {
        digitalWrite(laserOnPin, LOW );
    }
    delayMicroseconds(timePixel);
    digitalWrite(laserOnPin, LOW);
    } 
 
  }

  currentRow++; // prep the row counter for the next interrupt
  if(currentRow > 7) currentRow = 0;
}


    /**
    * setzt den PWM Impuls, um Modelbausteller (regler) für Bürstenlose Motoren (brushless)
    * zu regeln. PWM - Frequenz 50Hz (Periodendauer 20ms) , Impulslänge für Motor aus: 1 ms, für Motor vollgas: 1,5 ms
    * Entspricht einer Duty von 5% bis 7,5% bei 20ms Periodendauer. Bei einer Auflösung von 1024 (10bit) sind das etwa 52 - 77.
    */
    void setPWMRate()
    {
    Serial.println(fanspeed);
    duty = fanspeedoffset + fanspeed;
    if(duty>77){
    duty=52;
    }
    Timer1.pwm(pwmsender, duty);
    Serial.print("Duty: " );
    Serial.println(duty);
    }

    /**
    * liest die Zeichen von Serial solange bis ein '\n' (ASCII-Wert 10) gesendet wird oder der Zeichenpuffer buffer voll ist.
    * Danach wird fanspeed gesetzt und isfanspeedcomplete auf true gesetzt.
    * buffer max. Zwei Ziffern speichern.
    * Zeichen >9 und <0 sind ungültig, und werden ignoriert.
    **/
    void processFanSpeedMessage()
    {
    int newfanspeed = 0;
    char digit=Serial.read();
    Serial.print(digit);
    if( digit != 10 && i<2){
    if(digit>='0' && digit<='9')
    buffer[i++]=digit;
    }
    else{
    buffer[i]=0;
    newfanspeed = atoi(buffer);
    fanspeed = newfanspeed;
    isfanspeedcomplete=true;
    i=0;
    Serial.print("Fanspeed: ");
    Serial.println(fanspeed);
    }
    }

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #41 on: October 25, 2013, 12:52:35 PM »
Hi Georg,

We have some blinks, so we're half way there! :)

It will be very difficult for me to troubleshoot the code without having the actual hardware and I don't recognize some parts of the code.  I realize you've added some parts, so I need to understand what they are for.


What are these?
Code: [Select]
const int fanspeedoffset = 52;
char buffer[3];

What alerted me was the word "offset" in the variable name - is it in microseconds? This is a HUGE offset, even in microseconds. It actually looks like the laser is only ON during the time when the same mirror is in the way - it does not paint another line, so it looks like it only fires once per rotation, and it needs to do it 8 times per rotation.

I hope my input is making sense - it's really hard to know exactly what's going on.

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #42 on: October 25, 2013, 01:08:52 PM »
The fanspeedoffset is for the control of the ESC. In a 20 milliseconds period a signal between 1ms and 1.5ms is given to the ESC.
The buffer is for the input by serial.read - it is a number between 0 to 25 to control the signal length.
The code for the control of the speed is a little bit unnecessary complicated! I just copied it from the code of the guy, who made the ESC staff.
Both variables do not influence the Laserpin - they are just for the speedcontroll.

I agree: the synchronisation for each  mirror is a problem! Can we do this by timer?? Frankly spoken, I did not 100% undersatnd your code ... (it is your code? or isn't?)

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Laser Scanning Display Project
« Reply #43 on: October 25, 2013, 01:35:17 PM »
I agree: the synchronisation for each  mirror is a problem! Can we do this by timer?? Frankly spoken, I did not 100% undersatnd your code ... (it is your code? or isn't?)
LOL, the code is mine but it does not mean I understand what it does any better  ;D

Anyway, at this point I don't even know what code we're talking about. I looked at my Arduino sketchbook and I'm uploading here the last sketch I worked on back in September. I remember getting SOME traction with it (and multiple lines!) but my issues with integrating an ESC into the same code kinda spoiled all the fun. It is supposed to write the word "TEST", in case you ever get to that point ...

See zip file attached.

Please, keep me posted! 

Georg

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Laser Scanning Display Project
« Reply #44 on: October 25, 2013, 02:49:46 PM »
oh - I did not want to spoil your fun in the project ... I was already happy, that the motor is now turning!!
Thanks for your code, it is further developped compared to that one I used.
I will change the pwm part ...
(Next week I am in vacation so I come back in the following week  :))

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
11652 Views
Last post December 08, 2012, 02:05:19 PM
by smeezekitty
0 Replies
8185 Views
Last post November 02, 2011, 11:49:06 PM
by ElectroNick
0 Replies
11651 Views
Last post May 19, 2012, 09:04:54 PM
by ElectroNick
2 Replies
11607 Views
Last post December 14, 2012, 04:14:52 PM
by ElectroNick
14 Replies
13748 Views
Last post February 25, 2013, 12:24:16 PM
by ElectroNick