1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Guide Make your own USB LCD controller!

Discussion in 'Modding' started by ch424, 23 Jun 2006.

  1. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    @vali_ave
    That is a similar problem that was posted recently. The device may not use the standard offsets for the beginning of the lines. There may also be other subtle problems. Try using the command line to send an very long character string to the display (like all capital and lowercase letters than numbers and then some more). Make it well over 80 characters, like 128 characters. To send a string with the command line look back a few pages and there is a post on it.
     
  2. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    Thanks for your reply.
    When i send this command echo LongString&numbers > \\.\COM4 the first and third lines of the LCD only flicker. How subtle can the problem be? Can I have the source code? (vali_ave@yahoo.com)
    What do I try next?
     
  3. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    It is more probable to work with your version?
     
  4. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    Well, it sounds like there is a problem with the wiring from the chip to the LCD. I would double check everything and make sure all the wires are similar lengths, well connected, and the right order.

    I don't know if ch424 is following this thread anymore and so he may never send you his source code. However, my code is available on my website (www.coderforlife.com/projects/lcd/) but has a slightly different circuit.
     
    Last edited: 26 Apr 2011
  5. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    No, his version and mine work on the same exact principles. I used his as a starting point and learned most of everything I know from it. You could try it, but if you have problems with your connections, wiring, etc it is not going to help.

    The flickering sounds like its a soldering or loose connection issue. The chip only sends commands to the LCD to change it, but not to keep it steady. The D5/D6 wires are prime candidates.
     
  6. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    I triple checked the wiring and length from LCD to PIC. I also tried your version and still it doesn't work. With your design the device is not recognized probably because "The firmware freezes if it cannot communicate with the LCD". I think there is a problem with the initialization of the LCD. The data sheet for my LCD is here: http://www.google.ro/url?sa=t&sourc...&usg=AFQjCNGqordQK9Teo4B2Ds2eyZ742kqeyw(seems standard enough to me). I will try with another LCD on friday.
     
  7. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    Here is my prog config
    [​IMG]
    [​IMG]
    [​IMG]
    and the wiring
    [​IMG]
     
  8. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    The data sheet looks standard. The line offsets are right and it uses the standard HD44780 code / pins. Unless the LCD is bad, there is an issue with the wiring or the PIC is bad.

    I don't see any pictures in the last post.
     
  9. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    Got it.:)
    One of the 16 pins of the lcd had no connection with the LCD board (broken from previous use). This was obscured by the jack that i used.
    I will try your version now.
    Thank you.
     
  10. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    Awesome! I knew it had to be a wiring or connection issue! But it wasn't one of your connections, which is always difficult. Glad you found it!
     
  11. loctran

    loctran What's a Dremel?

    Joined:
    29 Apr 2011
    Posts:
    1
    Likes Received:
    0
    Thank Ch424 and everyone who made ​​this project. I have successfully implemented thanks to consult the people on this topic.
    My own experience when implementing this project:
    - Check the fuse to make sure that the MCU can successfully connect to your PC
    - Need to put two capacitors C3 and C5 PIC near as possible.
    - You can be with or without rotary encoder
    - You can be with or without Piezo
    - Make sure you have proper welding D- and D+ of USB port
    - Window PIC to identify the driver name: Communications Port (COM x)
    - LCD Smartie is true config matrix.dll the Startup Parameters: COM x, 9600
    Thank all again!
     
  12. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    There is another problem. After a few hours of use the LCD freezes and LCDSmartie also freezes. When it freezes the LCD shows the same character. It works again only if i reconnect the device.What can cause this problem?
     
  13. vali_ave

    vali_ave What's a Dremel?

    Joined:
    20 Apr 2011
    Posts:
    9
    Likes Received:
    0
    I have another problem. After a few hours of use the LCD and LCD smartie freeze. What can cause this?
     
  14. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    I have some suggestions to make, but first thanks to thaimin to make this project open source and all the info in his blog, and of course thanks to ch424 for the idea and work with the base code and initial board design. I'm not a coder, but I have some suggestions about the board design and hardware features

    The first problem I see in thaimin board are the JOUT1,2,3 outputs for fans.
    [​IMG]
    PC fans works at 12volts and JOUT1,2,3 are giving 5volts from 1 USB connector.

    PC fans can drain lot of amperes, 3 fans connected in a USB port can overload the capacitors of the 5 volts rail inside a power supply
    Additionally... there are special models of fans that drain A LOT of amperes, this ones for sure will blow up a power supply when connected to the 5volts rail

    The best secure way to manage fans is with a direct connection to the power supply, this is one of my suggestions, an added "molex" (or similar) connector to feed JOUT1,2,3 with 12volts
    The volts line that goes to JOUT1,2,3 headers comes from top-right, is easy to cut this line there to add the 12v connector

    An alternative is to manage only 1 fan with 3 speeds using JOUT1,2,3 (i.e. with resistors)
    1 = 5 volts
    2 = 8.5 volts
    3 = 12 volts

    --------------------------------------------

    Another problem is the way are aligned the screen connector pins, are not keeping the "standard" pin separation for this connector... and you added some more (for backlight and leds iirc)
    Resuming.... your aligment of pins in this connector makes impossible to connect a screen directly to the board

    There are other designs in this thread that connects the screen directly to the board by pins lines (male vs female), this seems a better approach to keep the standard and is what most people looks for, a compact design to fit behind the screen

    Several people showed minimized designs (like one made with holes breadboard)
    This designs are good too, and can be all them implemented in the same board
    Users needs some explains of the "supplementary" circuits that are optional. I think that is possible to make "one design that fits them all" lol, every user will cut the board at the desired size, they will only need a bit of photoshop or gimp to remove some traces

    -------------------------------------------

    About the initial buzzer that actually is removed... mmm I was thinking how to improve this
    One way is to make different sounds by using different pic outputs with different resistors
    Ideally... the 7 musical notes of the scale but you have only 5 outputs :/

    And is a bad idea to modify the code to convert two of the inputs to outputs, right ? (i saw in other pic projects that some pins can be reassigned to different functions, but I'm not sure in this case)

    --------------------------
    About the original rotary encoder... I still like the idea even after reading that ch424 kept having problems with it and lot of user said that don't works

    I have completely disassembled one of this "things" to understand what kind of signal sends
    My english is not good enough to explain this, and the explain would be too long, but:
    -Internally is a analogic device (it only sends 0 or 1) there are no electronic components inside and no special conductive materials
    -the signal sent to the receiver (the pic) must be interpreted as a "chain of bits"... one of this bits is not enough for the receiver to understand what is the signal
    -There is always 1 of the outputs sending a 1 (GND)... in other words, when you have a 0 in pinA you have a 1 in pin B (and viceversa)
    You will NEVER have pinA=0 pinB=0
    -So... you can have 2 "standby" positions (pinA=0 pinB=1 or pinA=1 pinB=0), the behaviour of the signal depends of this "standby" position
    -The output in my previous example, using the "standy" position as pinA=0 pinB=1 will be:
    to the right 0101...
    to the left 1010...
    -Take notice that if you rotate several positions... you are sending several 1 in both output pins (for every click, you send a 1 in the pin assigned to clockwise... and in the next click you are sending another 1 to the pin assigned to anti-clockwise)

    So I have no idea how this was working initially, I'm not sure if ch424 adapted the code for this behaviour o0
    But lots of people said that the rotational encoder can be replaced by buttons in ch424 design, so there was nothing to manage this kind of signals, but it was working? :confused:
    Sometimes electronics works by hidden magic arts :hip:

    ------------------------------------------

    Well... I found a way to use one of this rotational encoders by not using one of the pins (most exactly... the middle pin of the 3 ones, that is ground)
    *There is a moment when turning the wheel that outputA & outputB are connected... this will give us an 1 exactly like a button
    But this way you will have the same output by turning right or left

    My question is... ¿2 buttons are enough to navigate in the menus?... in other words, menus entries are "cyclic", after the last one it comes the first one in a bucle?
     
  15. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    Hi sandungas! You have provided extensive feedback on these projects. Thanks!

    One thing that you bring up time and time again is using resistors to change voltages. It turns out that this is unnecessary. Using PWM and a capacitor you can create any voltage from 0V to 5V from the output pins. That way you can conserve pins! The PWM is built into the program I wrote. It can take values from 0 to 255 (if I remember correctly) so that is 0.02V increments.

    Your molex idea is interesting, and can use the same PWM system but you need to add a transistor.

    I designed this using my "standard" screen. The pins work great. Every screen is different, some have the BL pins separated, some don't. The CrystalFontz ones typically have 2 rows of pins instead of one, and many of the duplicate the BL pins and some even have 2 sets of pins.

    Eagle can easily be used to delete circuit paths and change the location of the pins. I provide the Eagle source documents so that people don't have to start over.

    The buzzer can easily be added to the JOUT1-3 outputs. Using PWM you should be able adjust the pitch. The rotary encoder can be hooked up to the inputs in my circuit. The processing of the signals is handled by LCDSmartie or other software.
     
  16. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Good feature i was not aware of this, so the code is ready to make this regulation simple
    These capacitors are not present in your last squematic, right ?
    Btw... probably are needed a big ones to works as a "buffer" as a prevention when connecting powerfull devices

    About JOUT1-3... im glad to read that uses PWM too because i added a buzzer and a led there (mostly as examples) and both can be regulated
    Is an example, because can be replaced with 2 buzzers (for a buzzer chorus), 2 leds (or a bicolor led), or pins to connect other freaking awesomeness devices

    Ops, so the pic redirects the outputs from the rotary encoder to the pc ? mmm i thought there was someting at pic level to manage this in ch424 code

    After i wrote my laste message i was reading about how this rotary encoders works, and how to manage signals from them with pics, is the first time i read about it but i found some usefull info
    http://www.mcmanis.com/chuck/robotics/projects/lab-x3/quadratrak.html
    http://www.microchip.com/forums/m96826.aspx
    http://www.piclist.com/techref/microchip/language/c/io/qenc-dk.htm

    Them uses what is called "grey code" by using the output of 2 pins, each step of the sequence is made with 2 bits (i.e. 00 or 01 or 10 or 11), and the complete sequence has 4 steps
    The receptor (the pic) must interprete the sequence to know if the stick is turning clockwise or anti-clockwise
    In fact... it does not needs the fully sequence (made by 4 steps of 2 bits each)... the first 2 ones are enought (i.e. 00-->01...)

    The sequence that this rotary encoders creates depends of the internall parts, this is the one ch424 used:
    http://es.rs-online.com/web/search/...Products&searchTerm=263-2930&x=34&y=20#header
    The technicall characteristics can be resumed like this:
    30/15 60º±30º

    The first and the second number (30/15) is the number of "sectors" (as a cheese) for the internall roulette
    30 is the totall, but half of them are plastic ones... the other 15 are copper ones, are connected betweem them, and permanently with ground
    Is like a ninja star :)

    The other number (in degrees) refers to the point where the 2 pins connects with the ninja star
    In this example pinA is displaced 30º to the left - and pinB is displaced 30º to the right +
    So you can see something like: 60º+30-30 or 60º±30º (60º totall displacement, 30º for every side)

    Im trying to explain this because i been looking for lot of different models of this rotary encoders, and almost all are similar, it seems that the one that ch424 used is an standard, and the is a wide offer of alternatives for this component of the circuit

    The only different ones i saw was the ones with 20/10 steps, i dont remember exactly if this ones had the same 30º displacement, but probably yes, i guess there must be more models compatibles because this "grey code" they uses is an standard

    Btw... the one i have was savaged from a car stereo, audio devices uses to have one



    Finally... i been trying to redesing the board to fit in 80x36cm (to match the wide size of 16x2 LCD screens to be able to place the device in a 5.25" PC bay) i managed to add alll the things i said in my previous message and keeping a simple and modificable design
    [​IMG]
    I need to order one of this 16x2 screens from ebay to correct some measures
    Some chinese manufacturers are flooding ebay with cheap lcds, and i guess cheap is the standard
    I saw some different ones, but most have LCDpin1 next to the hole, this means that matches with mine

    Most important modifications:
    -Removed one of the "decoupling capacitors" because are optionall... you can place lot of them, but must be spreaded along the pic and separated. There is no point to place 2 of them side by side. The one left is needed in this position as a volts "buffer" in the power line that feeds the pic
    -Replaced the "crystal + load capacitors" by a resonator (a resonator is a crystal with 2 capacitors inside)... this was done because a problem of space available
    -Added traces for the rotatory encoder (placed in a extreme of the board as an option)

    *This area at the right of the board is not finished, i want to add some "alternative" traces to choose between leds, buzzers, pins, etc...
    I prefer not to upload the files yet, is not finall because i have only 2 old LCDs that doesnt matches with this pins
     
  17. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1

    To control the outputs, the following commands are available:

    Output on: 254 87 [1-5]
    Output off: 254 86 [1-5]
    Output PWM: 254 102 [1-5] [value:0-255]

    Even though the PWM can take a value 0 to 255, checking the code, it treats 1 as 0 and 254 as 255, so there is actually only 254 levels...

    Looking at LCDSmartie, I can't find the direct commands to control the output, but you can send them with $Chr. Using the LCD-Setter tool on the page, you can test out the outputs (called GPOs). You can even set up the default values.

    The capacitor is not in the current circuit. They could easily be added in-line to the connector. Some devices can handle PWM without worry, but some need the capacitor to "normalize" the voltage. PWM generates fast pulses of 5V, the capacitor can take this and turn it into a near-steady voltage. This is how the contrast (CT) pin works. Without the capacitor there is noticeable flicker in the display.

    As I say on my website, the outputs are actually all the same. What makes them "high" or "low" current is the transistor. They are all the same within the PIC.

    I now understand more about how these rotaries work! Thank you. Yes, it would be nice if it was handled within the PIC. However I think it still can be handled within the PC itself. Hooking it up to 2 inputs and monitoring those inputs on the PC as the grey code.

    Great design!

    I have always thought my design was silly for having those two capacitors right next to each other, but I kept them in case I decided to move them around.

    Not all ceramic resonators have the capacitors built in, but most do.


    Keep up the good work!
     
  18. Rorix

    Rorix What's a Dremel?

    Joined:
    21 Aug 2009
    Posts:
    10
    Likes Received:
    0
    same thing here bro
    i thought it was caused due to wiring problem or the lenght of the cables
    but so far no luck, wondering if you could provide us your insight about what might be the problem ;)
     
  19. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Sorry for the size of this image, but i saw the forum uses a plugin to resize images, i hope there is no problem with this, but if some moderator think is too big fell freee to erase the first link (but please left the tiny one in thumbnail)
    I see no way to attach files to this message in the forum, so i uploaded them to "sendspace", the link is at the end of the message

    The .zip contains 2 .pdf files for printing (no size problems with a .pdf) this screencapture (for reference), and the originall "PCBwizard" file (dont expect too much about this file, because im noob using the program, feel free to modify it but please upload it again to this thread with your changes)

    [​IMG]

    [​IMG][​IMG]

    Component list is the same that thaimin design---> http://www.coderforlife.com/projects/lcd/
    *some components are renamed to match pin numbers, or in order of importance

    I have all the components ready to build, but the board is not etched yet, i would like to read some critics about it ;)
    i.e. ... "a buzzer cant be driven by a PWM signall" and a capacitor cant solve it (if im not wrong)

    The capacitors added to the transistors to controll the fans are copyed from this document
    http://ww1.microchip.com/downloads/en/AppNotes/00771b.pdf


    FILES ----------> http://www.sendspace.com/file/o1bgtz
     
    Last edited: 15 Jun 2011
  20. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    Great design!

    A few notes though. I believe you should use the USB ground (not floppy ground) for the fan capacitors. Although, it may not matter. That is a nice document, and I hadn't even thought of that technique about reducing torque. Thanks for the link!

    The reason I wouldn't directly run a buzzer from a PWM output is you will probably get weird audio artifacts due to the constant switching of voltage. Thus if it is directly connected I would only use the PWM at 100% since then it won't be constantly switching from 0 to 5 volts but stay steady at 5V.

    A capacitor can convert the constantly switching voltage to an approximate average voltage. The capacitor C7 (C4 in yours) does this for the LCD contrast. Without it the display will flicker, especially noticeable at mid-level PWM (like 50%). I would recommend doing a similar thing for the buzzer. Through a lot of experimentation I arrived at 100uF. Too large and the capacitor never charges and the output stays at essentially 0V. Too low and the capacitor does nothing, letting through the rapid pulses instead of averaging them. This is a general technique for averaging out PWMs, not specific to buzzers.
     
Tags:

Share This Page