Show Posts
Pages: [1] 2 3 ... 14
1  Using Arduino / General Electronics / Re: 3v Laser Power design, and why did they all suddenly blow out? on: September 13, 2014, 04:35:11 pm
The Arduino forum always makes me laugh smiley thanks guys fingers crossed
2  Using Arduino / General Electronics / Re: 3v Laser Power design, and why did they all suddenly blow out? on: September 13, 2014, 04:10:33 pm
 Im sure they all have resistors pre soldered onto them. I think Mikes suggestion seems the most probable to me. I do remember the manufacturer posting a photo of running them with batteries while im using a PSU.

And yes i have the same ones, getting the same 25ma mark as you.

Ive ordered new, any precautions? i dont want to burn another lot...

PS, Mechanical Keyboard? Meh Chicklet FTW smiley-cool
3  Using Arduino / General Electronics / Re: 3v Laser Power design, and why did they all suddenly blow out? on: September 13, 2014, 12:55:23 pm
Oh im sorry, correction, i connect exactly 8 of them in Parallel. Individually they performed perfectly.
4  Using Arduino / General Electronics / Re: 3v Laser Power design, and why did they all suddenly blow out? on: September 13, 2014, 11:33:30 am
I tested all of them individually for 5-6 minutes and they worked just fine. Its just when i connected them in series. Its very odd as all of them dimmed at the same time and died.
5  Using Arduino / General Electronics / 3v Laser Power design, and why did they all suddenly blow out? on: September 13, 2014, 11:07:56 am
I got a bunch of cheap 3v laser diodes,
http://www.ebay.co.uk/itm/10pcs-650nm-6mm-3V-5mW-Laser-Dot-Diode-Module-Head-With-Red-Dot-v-h9-/321227815230?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item4acaab793e

They have a very simple "driver" which consists of a resistor merely soldered onto the housing, it is powered off 3v.

So i connected about 8 of them in parallel to a 3v supply, initially they worked fine but all of a sudden they all dimmed down and faded away. What caused them to burn out even though i was powering them off a smooth 3v? They worked fine individually.
6  Using Arduino / Programming Questions / Re: Faster Shiftout, how? on: September 02, 2014, 12:22:37 pm
I can't see how the speed has any bearing on how many bytes are transmitted. It may have a bearing on how the printer handles them.

Quote
I can write 24 bytes but nothing gets transmitted after that.
How do you know this? Logic analyser trace?

Quote
If anyone wants ill attach the timing diagrams/datasheet.
That would be good.

______
Rob


I do agree it is quite odd, the transmission cut off. Whats even more odd is that the thermal printer print array consists of 6 heating blocks, each of 8 bytes. I can transmit perfectly to the first 3 but not the last three. Seldom i manage to address the last 3 but it is not consistent so im thinking its a speed issue.


No it i dont have a logic analyzer, its just a guess.

I have attached the datasheet.

You can write your own shiftout function and remove the for loop.
Have a look on wiring_shift.c file
Code:
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{
uint8_t i;
for (i = 0; i < 8; i++)  {
if (bitOrder == LSBFIRST)
digitalWrite(dataPin, !!(val & (1 << i)));
else
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
}
change
Code:
uint8_t i;
for (i = 0; i < 8; i++)
by
Code:
uint16_t i;                        // with  uint8_t  imax= 255  too  low for 384 bits
for (i = 0; i < 383; i++)   // i<8 is for transmiting byte   --> i<383 is for transmiting 384 bits

Other improvement:  remove the arduino function digitalWrite and use direct register DDRx and PORTx manipulation. You will be 10 time faster.
Other solution use SPI : it can works with a 8MHz clock.

Would not using a for loop also speed it up? Im taking up your advise on using direct port addressing for sure!
7  Using Arduino / Programming Questions / Faster Shiftout, how? on: September 02, 2014, 09:56:11 am
Im driving a thermal printer head from the arduino uno, it takes 384 bits per line, so i have to Shfitout 384 bits each time.

Currently Im using a For loop:

Code:
void Write() {
  digitalWrite(latchPin, HIGH);
  for (int i = 1; i <= 48; i++) {
    shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
  }
  digitalWrite(latchPin, LOW);
}

However the problem with this code, that i suspect is that it isnt fast enough (?). I can write 24 bytes but nothing gets transmitted after that.

PS i have little or no understanding of specific timing diagrams. However, i just tried the normal shiftout with my application and it seemed to work, albeit for just 24 bytes instead of the full 48 bytes. If anyone wants ill attach the timing diagrams/datasheet.
8  Using Arduino / Project Guidance / Re: Find nearest multiple of 8 from a variable? on: September 02, 2014, 08:44:27 am
Oh i see, Thankyou!, ive come up with this, dont have an arduino at hand to test it, what do you guys think:

Code:
X = 8 * ceil((X / 8))
9  Using Arduino / Project Guidance / Re: Find nearest multiple of 8 from a variable? on: September 02, 2014, 08:32:06 am
How so?

Say X = 4,

4/8 = 0.5

0.5 + 1 = 1.5

1.5*8 = 12 (Should be 8 ).

edit: Whoops, i dont know what im on about here, should be 8
10  Using Arduino / Project Guidance / Find nearest multiple of 8 from a variable? on: September 02, 2014, 08:25:15 am
Hi,

i want a sketch that would return the nearest multiple of 8 (rounded up always) from a variable, for example.

X = 4, returns 8
X=1,  returns 8
X=8, returns 8
etc...

X=11, returns 16
X=14, returns 16
etc...

X=20, returns 24
X=17, returns 24
etc
11  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 07:38:45 pm
Thanks for the nice overview, cleared things out  smiley. However, i have thankfully managed all that, and my sketch can read bytes, print, move to next row of bytes etc. Just needed a font format that could integrate with the way my code works. It looks like i found one, its called Dot Factory, and is one of the best ive used till now!

http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/

Ill be writing a sketch and report back on how the fonts worked out. Here are some of the bitmap printing my sketch did:



12  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 06:13:21 pm
Not quite, i salvaged an old credit card machine, it has a very high resolution printer in it. Yes ive seen that printer, but that is driven serially and i cant find any actual font arrays in their library so i think the fonts are handled by a separate driver IC in the printer so the arduino doesnt have to worry about it. In my case im driving it bare, directly off its ribbon cable.
13  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 02:46:29 pm
Currently the thermal printer hack is working beautifully with Bitmap images! Im using LCD Assistant, that spits out a byte array, by dividing the image horizontally into bytes and then moving onto the next line. Its only font generation that is troubling me, and im hoping a simple process exists for fonts.

http://en.radzio.dxp.pl/bitmap_converter/
14  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 02:43:03 pm
Convert the hex values to binary. 0x06 = 0b001100. Now look at the picture. Compare the black and white squares in the top row to the 0 and 1 pattern. See a relationship?
Doesn't look like any sort of relationship to me other than both happen to have 2 consecutive "1" bits.
Compared on top of each other:
Code:
000XX000 - top row
00001100 - 0x06

To me, the 6 looks like some kind of font size indicator then the pixel data follows.
It looks to be stored vertically, where bit 0 is at the top
and the pixels are mapped from bottom to top and then left to right.
For non multiple of 8 sized fonts like this one, it looks like the pixel data
is adjusted down so the unused bits in the pixel data will be off the bottom
or will be the upper data bits of that data byte.

So skip over the 6. you will need to figure out what the byte is later by looking at different font sizes.

Then if you look at the data, it looks like each column moving from left to right is two bytes of data.
In the data pair, the first byte is the lower pixels, and next byte is upper pixels.
In the first byte, bits 6 and 7 are not used (the font size of 14 is not a multiple of 8 ),
then the bits lay down going up.
In the second byte, all 8 bits are used and go up from where the first byte stops
and is the upper 8 vertical pixels.
i.e. the bottom pixel will be bit 5 of first byte the pixel byte pair and the upper pixel will be bit 0
of the 2nd byte of the pixel byte pair.


GLCDs like the ks0108 vertically map their pixels like this. However, for speed you really
want to write the pixel data horizontally within the 8 bit pixel page.
This font format would require that you scramble your read accesses to get the pixel data in that order.

It can be a real challenge to do this along with taking into consideration arbitrary y pixel coordinate alignment.
My openGLCD library takes all this into consideration to minimize glcd data writes
when doing its rendering which is why the font rendering code  is so complex.

--- bill





Thanks, its making sense now! To give you a bit of background, im basically wanting to generate fonts for a high resolution thermal printer that prints much like a dot matrix, 384 dots horizontally then next line and so on. Is there a way/program that let me output simple fixed height and width fonts horizontally formatted? As i think parsing this format to work with my application is a slight overkill..Thanks again
15  Using Arduino / Programming Questions / Re: GLCD Font Format help. on: September 01, 2014, 12:57:47 pm
Yes that was my first intuitive guess, but that pattern doesn't quite hold, as the next is 0x00 which it clearly isnt from above or below..
Pages: [1] 2 3 ... 14