HELP me with POV

I am working on a rotating POV display (propeller display)..

The circuit is totally ready and is displaying the message that I have programmed..

The problem which I am facing is that I am unable to fix the starting position of the message with the interrupts from hall sensor..
Please guide me with that..

I have attached a picture of the whole PCB..

  #define WIDTH 5        //Width of letters
  char msg[]="RON";
  const byte font [][WIDTH][8] =
{ 
  { {0,1,1,1,1,1,0,0}, 
    {1,0,0,0,0,0,1,0}, 
    {1,0,0,0,0,0,1,0}, 
    {1,0,0,0,0,0,1,0}, 
    {0,1,1,1,1,1,0,0}}, //0         // 48th position of ASCII code
    
  { {1,0,0,0,0,0,0,0}, 
    {1,0,0,0,0,1,0,0}, 
    {1,1,1,1,1,1,1,0}, 
    {1,0,0,0,0,0,0,0}, 
    {1,0,0,0,0,0,0,0}}, //1
    
  { {1,0,0,0,0,1,0,0}, {1,1,0,0,0,0,1,0}, {1,0,1,0,0,0,1,0}, {1,0,0,1,0,0,1,0}, {1,0,0,0,1,1,0,0}}, //2
  { {0,1,0,0,0,1,0,0}, {1,0,0,0,0,0,1,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {0,1,1,0,1,1,0,0}}, //3
  { {0,0,0,1,0,0,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,1,0,1,0,0}, {1,1,1,1,1,1,1,0}, {0,0,0,1,0,0,0,0}}, //4
  { {0,1,0,0,1,1,1,0}, {1,0,0,0,1,0,1,0}, {1,0,0,0,1,0,1,0}, {1,0,0,0,1,0,1,0}, {1,1,0,1,0,0,1,0}}, //5
  { {0,1,1,1,1,1,0,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {0,1,1,0,0,1,0,0}}, //6
  { {0,0,0,0,0,0,1,0}, {1,1,1,1,0,0,1,0}, {0,0,0,0,1,0,1,0}, {0,0,0,0,0,1,1,0}, {0,0,0,0,0,0,1,0}}, //7
  { {0,1,1,0,1,1,0,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {0,1,1,0,1,1,0,0}}, //8
  { {0,1,0,0,1,1,0,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {1,0,0,1,0,0,1,0}, {0,1,1,1,1,1,0,0}}, //9
  { {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {1,1,0,0,1,1,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}}, //: 
  {},                                                                                                // as we do not need this ASCII codes, so false
  {},
  {},
  {},
  {},
  {},
 
  
  {{1,1,1,1,1,0,0,0}, {0,0,1,0,0,1,0,0} , {0,0,1,0,0,0,1,0} , {0,0,1,0,0,1,0,0} , {1,1,1,1,1,0,0,0}},		//A      ASCII CODE 65
  {{1,1,1,1,1,1,1,0}, {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {0,1,1,0,1,1,0,0}},		//B
  {{0,1,1,1,1,1,0,0}, {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {0,1,0,0,0,1,0,0}},		//C
  {{1,1,1,1,1,1,1,0}, {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {0,1,1,1,1,1,0,0}},		//D
  {{1,1,1,1,1,1,1,0}, {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,0,0,0,0,0,1,0}},		//E
  {{1,1,1,1,1,1,0,1}, {0,0,0,1,0,0,1,0},  {0,0,0,1,0,0,1,0},  {0,0,0,1,0,0,1,0},  {0,0,0,0,0,0,1,0}},		//F
  {{0,1,1,1,1,1,0,0}, {1,0,0,0,0,0,1,0},  {1,0,1,0,0,0,1,0},  {1,0,1,0,0,0,1,0},  {0,1,1,0,0,1,0,0}},		//G
  {{1,1,1,1,1,1,1,0}, {0,0,0,1,0,0,0,0},  {0,0,0,1,0,0,0,0},  {0,0,0,1,0,0,0,0},  {1,1,1,1,1,1,1,0}},		//H
  {{1,0,0,0,0,0,1,0}, {1,0,0,0,0,0,1,0},  {1,1,1,1,1,1,1,0},  {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0}},		//I
  {{0,1,0,0,0,0,1,0}, {1,0,0,0,0,0,1,0},  {0,1,1,1,1,1,1,0},  {0,0,0,0,0,0,1,0},  {0,0,0,0,0,0,1,0}},		//J
  {{1,1,1,1,1,1,1,0}, {0,0,0,1,0,0,0,0},  {0,0,1,0,1,0,0,0},  {0,1,0,0,0,1,0,0},  {1,0,0,0,0,0,1,0}},		//K
  {{1,1,1,1,1,1,1,0}, {1,0,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0}},		//L
  {{1,1,1,1,1,1,1,0}, {0,0,0,0,0,1,0,0},  {0,0,0,0,1,0,0,0},  {0,0,0,0,0,1,0,0},  {1,1,1,1,1,1,1,0}},		//M
  {{1,1,1,1,1,1,1,0}, {0,0,0,0,1,0,0,0},  {0,0,0,1,0,0,0,0},  {0,1,0,0,0,0,0,0},  {1,1,1,1,1,1,1,0}},		//N
  {{0,1,1,1,1,1,0,0}, {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {1,0,0,0,0,0,1,0},  {0,1,1,1,1,1,0,0}},		//O
  {{1,1,1,1,1,1,1,0}, {0,0,0,1,0,0,1,0},  {0,0,0,1,0,0,1,0},  {0,0,0,1,0,0,1,0},  {0,0,0,0,1,1,0,0}},		//P
  {{0,1,1,1,1,1,0,0}, {1,0,0,0,0,0,1,0},  {1,0,1,0,0,0,1,0},  {1,1,0,0,0,0,1,0},  {1,1,1,1,1,1,0,0}},		//Q
  {{1,1,1,1,1,1,1,0}, {0,0,0,1,0,0,1,0},  {0,1,1,0,0,0,1,0},  {0,1,0,1,0,0,1,0},  {1,0,0,0,1,1,0,0}},		//R
  {{0,1,0,0,1,1,0,0}, {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,1,0,0,0,1,0,0}},		//S
  {{0,0,0,0,0,0,1,0}, {0,0,0,0,0,0,1,0},  {1,1,1,1,1,1,1,0},  {0,0,0,0,0,0,1,0},  {0,0,0,0,0,0,1,0}},		//T
  {{0,1,1,1,1,1,1,0}, {1,0,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0},  {0,1,1,1,1,1,1,0}},		//U
  {{0,0,1,1,1,1,1,0}, {0,1,0,0,0,0,0,0},  {1,0,0,0,0,0,0,0},  {0,1,0,0,0,0,0,0},  {0,0,1,1,1,1,1,0}},		//V
  {{1,1,1,1,1,1,1,0}, {0,1,0,0,0,0,0,0},  {0,0,0,1,0,0,0,0},  {0,1,0,0,0,0,0,0},  {1,1,1,1,1,1,1,0}},		//W
  {{1,1,0,0,0,1,1,0}, {0,0,0,1,1,0,0,0},  {0,0,0,0,1,0,0,0},  {0,0,0,1,1,0,0,0},  {1,1,0,0,0,1,1,0}},		//X
  {{0,0,0,0,0,1,1,0}, {0,0,0,0,1,0,0,0},  {1,1,1,1,0,0,0,0},  {0,0,0,0,1,0,0,0},  {0,0,0,0,0,1,1,0}},		//Y
  {{1,1,0,0,0,0,1,0}, {1,0,1,0,0,0,1,0},  {1,0,0,1,0,0,1,0},  {1,0,0,0,1,1,0,0},  {1,0,0,0,0,1,1,0}},		//Z
  
 
};
int c;

void setup()
{  

     setTime(12,0,0,1,1,12); // set time to noon Jan 1 2012

  for (int k=6;k<=12;k++)
     pinMode(k,OUTPUT);
     
}


void display (char POVstring[])
{
   for (int i=0; i<(strlen(POVstring)); i++)
   
      { 
      for (int j=0; j<(WIDTH); j++)
         { c=0;
           for(int k=12;k>=6;k--)
             {
            digitalWrite(k,font[(int)POVstring[i]-48][j][c]); //displaying port type

         c++;}
          delay(10); 
          
         for(int k=6;k<=12;k++)
             {
            digitalWrite(k,0); // displaying noting port type
             }
         delay(1); 

} delay(10);
      }


    
}



void loop()
{

 message();
 
}


void message()
{
  display(msg);
}

The code does not contain anything about the hall sensor..?

In the very beginning of your displaying function, try something like:

while(digitalRead(hallSensorPin) == false) { }. This should make the displaying hold until the sensor passes over the magnet.

Using a whole precious byte of RAM to store one bit of data isn't very sensible.
Pack the bits and put them in PROGMEM.

oskarbjo:
The code does not contain anything about the hall sensor..?

In the very beginning of your displaying function, try something like:

while(digitalRead(hallSensorPin) == false) { }. This should make the displaying hold until the sensor passes over the magnet.

Thank You oskarbjo that just did the job.. This simple thing just did not come into me.. :frowning: :stuck_out_tongue:

Now another challenging part is that I would like to display an analog clock.. Now I would like to place the minuets dots , how to do that..

I thought of calculating time taken for a revolution and divide that in 60 parts and place the dots..
But just cant get it correct..

Take a micros or millis timestamp when the Hall effect triggers each rotation, and use that to time individual revolutions.

http://forum.arduino.cc/index.php?topic=181221.msg1346522#msg1346522

AWOL:
Take a micros or millis timestamp when the Hall effect triggers each rotation, and use that to time individual revolutions.

HELP me with propeller clock (analog) - #3 by nemo4all - Project Guidance - Arduino Forum

The link to the thread you have given me is started by me..
I thought it that way but just unable to form the code..

I thought it that way but just unable to form the code

Well, post what you've got.

I tried this code to light an LED for half rotation.. But it is not working.

unsigned long lasttime = 0;
unsigned long timetaken;


void duration(){
  unsigned long now = micros();
  unsigned long interval = now - lasttime;
  
  timetaken = interval;
  
  lasttime = now;
  
}

void setup(){
 // Serial.begin(9600);
  pinMode(2, INPUT);
  attachInterrupt(0, duration, FALLING);
}

void loop(){
//  attachInterrupt(0, duration, FALLING);
//  Serial.print("\t time taken=\t");
//  Serial.println(timetaken);
  
  while(digitalRead(2) == false) {
  digitalWrite(5, HIGH);
  delayMicroseconds(timetaken/2);
  digitalWrite(5, LOW);
  }
  
  
}

But it is not working.

That's a shame.

I'd offer more than platitudes, if you offered more than "it is not working"

AWOL:

But it is not working.

That's a shame.

I'd offer more than platitudes, if you offered more than "it is not working"

Sorry or saying " it is not working"

can you please show me where is the mistake I am making, that the light is only staying on 1/4 of the full rotation....??

I feel I am making a mistake here.. Because when I try with fixed delay like when I set 10000 microseconds the light glows for 1/4 of the rotation, but when I set 40000 microseconds delay the lights glows less that 1/8 of the rotation, where as it should glow for 1/2 of the rotation.(if 10000 microsecond delay makes it glow for 1/4 rotation).

  while(digitalRead(2) == false) {
  digitalWrite(5, HIGH);
  delayMicroseconds(timetaken/2);
  digitalWrite(5, LOW);
while(digitalRead(2) == false) {

It would be useful to know what is attached to pin 2. It would be useful to know why you need to read that device again, since it is triggering an interrupt, and you can tell whether or not the interrupt has been triggered,

Because when I try with fixed delay like when I set 10000 microseconds the light glows for 1/4 of the rotation, but when I set 40000 microseconds delay the lights glows less that 1/8 of the rotation, where as it should glow for 1/2 of the rotation.(if 10000 microsecond delay makes it glow for 1/4 rotation).

Some clue as to how long a rotation lasts would be useful. The digitalRead() and digitalWrite() functions are not all that fast. If the propeller is rotating at 40000 RPM, you may be missing events while the digitalRead() function is determining which physical pin to read. IF that is the case, direct port manipulation will be necessary (and much faster).

PaulS:

while(digitalRead(2) == false) {

It would be useful to know what is attached to pin 2. It would be useful to know why you need to read that device again, since it is triggering an interrupt, and you can tell whether or not the interrupt has been triggered,

I have a AH34 HALL Sensor attached to pin 2..

14 questions, 1 answer is the wrong ratio.

I have a AH34 HALL Sensor attached to pin 2..

How?
Do you have a pull up resistor fitted as well or have you enabled the internal pull up resistors. The code you posted implies you have not used the internal pull up resistors.

Unless you are more forthcoming with information people will find it difficult to help.

Grumpy_Mike:

I have a AH34 HALL Sensor attached to pin 2..

How?
Do you have a pull up resistor fitted as well or have you enabled the internal pull up resistors. The code you posted implies you have not used the internal pull up resistors.

Unless you are more forthcoming with information people will find it difficult to help.

Oh I have a 10k resistor attached to +5v and pin 2..

PaulS:
14 questions, 1 answer is the wrong ratio.

I have a AH34 HALL Sensor attached to pin 2 ( with an external 10k pullup resistor connected to +5v). I am reading that device again to fix the starting position of the message to be displayed, as I cannot find out how to do that with an interrupt..

I have not recorded the microseconds take for each revolution as I cannot stay connected while the circuit is in rotation.. But it is possible to record that data in the EEPROM and retrieve it later.

I am reading that device again to fix the starting position of the message to be displayed, as I cannot find out how to do that with an interrupt..

The way you do that is to set a flag (Boolean variable ) in the ISR and then read that flag in the loop to see if the interrupt has been triggered. When it has clear the flag and proceed. This is much safer than reading it twice.
Make sure the variable is declared as volatile.

Grumpy_Mike:

I am reading that device again to fix the starting position of the message to be displayed, as I cannot find out how to do that with an interrupt..

The way you do that is to set a flag (Boolean variable ) in the ISR and then read that flag in the loop to see if the interrupt has been triggered. When it has clear the flag and proceed. This is much safer than reading it twice.
Make sure the variable is declared as volatile.

I was trying something like this..But still the same

boolean x ;
unsigned long lasttime = 0;
unsigned long timetaken;
int addr = 0,c;

void duration(){
  unsigned long now = micros();
  unsigned long interval = now - lasttime;
  
  timetaken = interval;
  
  lasttime = now;
  
        x = false; c=0;
        
}

void setup(){

 pinMode(5, OUTPUT);
  
}

void loop(){
   attachInterrupt(0, duration, FALLING);
  if(c==0){
  digitalWrite(5, 1);
  delayMicroseconds(timetaken/2);
  x=!x;
c++;}
  digitalWrite(5, 0);
  
}