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. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    I joined ground in all the connectors pins to stabilish voltages, btw... the 3 blue "flying wires" are ground, i refused to use flying wires other than ground lines to avoid shorcuts (i.e. when connecting cables or if you touch the board with your hands when working)

    By reading this microchip document, i see the capacitors for the fan lines must be exactly measured, and this can vary for different boards builds (capacitance of the traces of the board, or solder points) or different transistors used
    Im not sure of which ones will work fine, but this components are optionall, if there is a problem with this capacitors i will simply remove them and the PIC will controll the fans with PWM signals

    And talking about optionall components and suplementary circuits...
    My goal was to add the rotary enconder (displaced of the LCD module as a car stereo), the addition of the USB-B verticall connector, and fit all in a 5.25" PC bay (for a 2x16 characters LCD)
    This gaves me the final size of the board, there is no way to reduce it more because the big holes at the corners must match the holes in the LCD module (i will align the 2 boards with "3mm diameter 25mm long" bolts, and around 60 nuts

    At first i had an empty space at the left and the right of the board... so i added all the lines for fans, buzzer & led
    All this is optionall, and can be considered "suplementary circuits/components"

    the rotary encoder is a supplementary component too, it has a 3 pin (OUT) connector that must be wired to (IN) connector in the pins desired by the user
    The left pin of the rotary encoder is a simple button switch that the encoder has internally (when you press it), the other 2 pins are for the "gray code"
    Im not sure if the gray code will work, but there is a way to convert this 2 pins to a simple 1-0 output as a button switch (by joining the central or right pin to ground and the other one as output)
    This will make the rotary encoder to only output 2 signals without gray code: 1 when you push it, and 1 when you turn it (the direction of the rotation will make no difference)
    *notice the pin at the right of the IN connector is ground, this pin is the best option to make this tweak

    About the buzzer and the led... well... i thougt some ways to add different holes and connectors in this area to connect different things and remain compatible with your connectors, but in the end i see this is complicated
    If im not wrong, there is no way to make the 7 musicall notes with a PWM signall, so other solutions for the buzzer are not good, i prefer having a crazy buzzer that emits pulses than a buzzer that makes a plain "beeep" :D
    Either way... maybe eventually somebody will remove the PWM code for buzzer and led (there is no need to remove it in the led, but if somebody decided to make this change i see a good idea to change both to standarize things)

    The list of optionall/supplementary circuits/components is something like this:
    - Rotary encoder + OUT connector (this is an alternative way to input signals in the IN connector)
    - LED + R12 resistor (the resistor can vary for different LED intensity around 330ohm)
    - Buzzer
    - Capacitors C5, C6, C7 (to stabilish PWM fan controll signalls)
    - Fan controll circuit: R8,R9,R10 - Q2,Q3,Q4 - F1,F2,F3 - FLOPPY

    The program i used to make the board is a bit limited, the led must be replaced by a 2 pin connector, C4 is an electrolytic capacitor, the encoder & the USB-B (verticall) connectors was made by hand, this real components has a metal shield with legs.... but the leg position is different in some manufacturers, i added 2 big copper lines behind them but there are no marks to drill the board, you must drill to match the legs of your components


    ---------------------------
    Well, if the only problem is the buzzer i think i must build it, i like the fact that the board will be compatible if the code changes in the future, and is a bit "tweakable" to addapt to different solutions
    If the code dont changes is actually compatible, even the encoder will work (tweaked), and the buzzer will beep (crazy) but it will work
     
    Last edited: 16 Jun 2011
  2. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    The complete gray should be readable by LCD Smartie if you send the whole thing. Also, using a little extra code in the PIC you could actually make it do something very intelligent with the gray code.

    Have you tried with the buzzer? Here is an article that describes the Digital to Analog conversion (DAC):
    http://www.diolan.com/articles/dac.html
    One major problem is this PIC does not have any analog outputs, so PWM is the ONLY choice. An external DAC is necessary.
     
  3. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    The incompatibility i see with the gray code is this "whole thing" is a sequence of 4 steps, every step are 2 bits i.e.
    step1 = 00
    step2 = 01
    step3 = 11
    step 4 =10
    For every "click" on a rotary encoder you are sending this full sequence with this 4 steps (or similar)
    The receiver (PIC or LCDsmartie) needs to "wait" for the full sequence to "translate" all this as a single input

    This is why i think the pins assigned to gray code seems to be incompatible with simple buttons, because the receiver will take step2 (in my example) as an input for a single button, and at this point the sequence is "broken"
    Maybe LCDsmartie has some code to translate this (¿but this would cause a delay in "normal" operation with buttons?) , ive not tested yet, but i doubt it will work

    Hmmm, this looks good, and not too much components involved, maybe i will try later because i build the board
    [​IMG][​IMG]

    Is not finished yet, and the etching was bad, im still experimenting with the laser printer method using different quality papers
    This one was made with a crappy paper (after 3 fails with glossy paper) and lot of tin to fix traces

    Quality of photos is bad, are only a test to see if all the holes, bolds, connectors are aligned, and the height of the rotary encoder
     
    Last edited: 18 Jun 2011
  4. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Is alive \o/

    bootloader works fine, the device appears in windows (in device managemente screen) as a "Custom USB devices/Microchip custom USB Device"
    bootloader.hex file contains the correct settings, and is ready to be programmed, it does not need any modification, i used "winPIC800" to program it, and a "JDM programmer"
    This is the (default in the .hex) correct settings in winpic800 if somebody want to use this app as an alternative

    [​IMG]

    LCDsetter is great, allowed me to configure and old LCD (ripped from a old cash register) by removing the blinking dash and a black square in the first character (it was intented to enter text), to set the LCD to be permanently powered (tested for 24 hours and working), high contrast (from 127 to 150), and the wellcome message (Kill humans, bip, bip, bip) lol
    LCDsetter autodetects the PIC port (when the PIC has the bootloader), and the full firmware installation/update works perfect
    Is a great app really, more htan i expected, it deserves more attention in your blog thailim ;)
    Im not sure how the "special characters" works, and how to find some use about them, but i will keep testing with old LCDs, if you need some kamikaze tester to improve the program just ask
    Most of this settings are stored in the PIC eeprom, but i suspect that other is stored in the LCD chip?

    The other driver for the full firmware works fine too, the device appears in windows (in device managemente screen) as a "Ports (COM & LPT)/USB2LCD+ COmmunications Potr (COM7)", all installation was pretty easy with the files you provided thanks for all the support

    About the "USB2LCD.dll" for LCDsmartie...
    There is a way to config an output to increase fan speed in % ?
    It seems there is a "bug" with the range given for output GPO's, the example suggest a range from 4-8 (it must be 4-5)


    I tryed to install all in a 18f2455, the writing of the bootloader was right and was detected by windows as a "Custom USB devices/Microchip custom USB Device", but LCDsetter cant find it
    The problem is in the bootloader that was compiled for 2550 ? the size of the .hex ?

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

    About my design... it works pretty fine i can controll backlight without problem, fans can be regulated too, and the capacitors i used for the fans transistors (1uF) does nothing bad (there is no annoying noise even at low speeds, but i didnt compare without capacitors)

    But if somebody is thinking in build it i suggest you to wait a bit more because there are several components that better must be moved 1 or 2 milimeters (IN connector, FAN connectors, and the 100nF capacitor) no big problem whith these

    The buzzer can be considered an epic fail, this area must be redrawing completly
    It has a permenent sound like "prrrrrrrrrtttttt"
    The interesting effect is everytime a character changes in the LCD the buzzer emits a "click", this effect is not bad, even is cool when screens changes to the next one (but i have no idea from where this output comes, because is not cofigured in lcdsmartie... maybe an interference from my led line?)
    By now i disabled this output, a thing that emits "clicks" or "prrrt" constantly is a torture more than a feature

    I found a perfect use for the led to light the encoder dial (usually this dials like the one i used has a transparent plastic)
    So i moved the led near the rotary encoder and now the dial can blink

    The rotary encoder works fine "tweaked" as i explained, i will test gray code further
    In my previous message i was wrong when i said the full gray code sequence is sended in every "click" of the encoder... in fact it needs 2 "clicks" to send all 4 steps
    By now without gray code i have 2 buttons in the encoder, im not sure if will be enought inputs to controll all the posibilityes, maybe i will add the other buttons to the squematic

    Next step will be some test to see if i can fix the buzzer thing, and i will redraw the squematic (i have no hurry, if somebody wants it fast let me know, but i would like to fix the buzzer thing before)
     
    Last edited: 20 Jun 2011
  5. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    Great! Awesome that things are working quite well and that you like my programs. Hope your future iterations are even better!

    LCD uses the value 0-255 for characters and each LCD uses different characters (although they seem to always use the standard ASCII values (32-126) for space, letters, and numbers). Outside of those, the only way to find out what the characters are is to look in the manual (if available), or send those characters to the LCD. Typically 0-7 are for the custom characters and sometimes 8-15 are duplicates of those.

    The values outside the standard ASCII range aren't typable (e.g. value 127 is the DEL key on keyboards which will delete a letter not type the value 127) which is why there is a special thing to add "special characters". You can make the program display the proper special chars for you LCD by creating your own chars.txt file, but that doesn't effect the LCD, only the display within the program.

    All are stored in the PIC EEPROM. Here is the layout:
    [​IMG]
    Also, the last byte (0xFF) is used for bootloader operation.

    Not now. All the PWMs (backlight, contrast, and GPOs) use the same system internally and since backlight and contrast need to be 0-255, so must the GPOs. You can use the simple equation to convert:

    Code:
    value = percentage * 255 / 100
    If you use the math LCDsmartie plugin, you can make the conversion automatic.

    Which example? Where is this?

    This is definitely possible. It hasn't been tested on any of the 18Fx455 series. I have heard that at least the firmware by itself works on the 18F4550 chip. The size of the hex only writes things within the first 16KB and 18F2455 has 24KB of memory, so that shouldn't be a problem. I looked at some of the core files, and it turns out that 18Fx455 series and 18Fx550 series link to different libraries (but 18F2550 and 18F4550 link to the same library). That is probably the reason it is failing.

    Sad that this didn't work. The "prrtt" may be due to the PWMs. Try with a DAC? The clicking sounds like interference. Every time you change a character, many of wires going to the LCD change rapidly, and the LCD itself probably puts some extra resistance on the voltage line, creating noise all over the system. The truth is a DAC may filter out this noise automatically!

    Rotatory
    I am considering adding in a rotatory-interpreter into the PIC code. There would be an additional setting in the LCD-Setter to enable it, and it would use 2 of the input pins. Just to make sure I understand this, below is my interpretation:

    00 > 01, 01 > 11, 11 > 10, 10 > 00 Right
    01 > 00, 11 > 01, 10 > 11, 00 > 10 Left
    00 > 11, 01 > 10, 11 > 00, 10 > 01 2x previous action

    I won't be able to get to this before this weekend, but it would be nice to add.
     
  6. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Hmm, this screen capture of the eeprom layout is very explicit, im beggining to understand how the special characters works and i realized that i need to configure them because some of the characters dont matches my LCD
    I thought that part of the config done with LCDsetter was stored in the LCD board chip (probably because the first time you open LCDsetter it appears 3 "strange" characters)... i thought this was not part of the PIC code, but i was wrong, is good to know that there is no possibility to "brick" the LCD because corruption problems or weird configs

    About what i asked for the fans controll... i was trying to assign 1 button in LCDsmartie to increase fan speed in steps (and another one to decrease)
    I mean... with every push of the button the speed increase i.e. in 25% , this way yo have 5 different speeds with only 1 button (0% 25% 50% 75% & 100%)
    Im not sure if this can be done in LCDsmartie, im still learning how it works

    The bug i tolk about is the suggested range for outputs in LCDsmartie, in "actions" screen
    Im not sure if is a bug, or from where it comes, but the board has only 5 outputs (the maximun number of outputs must be 5, not 8)
    [​IMG]

    With the 18f2455 i didnt tested to write only the firmware (without bootloader) but i loaded the firmware.hex in the programmer, and realized that is missconfigured (it contains random config bits for the crystal, etc...) and needs to be configured properly (i supposed that the config copyed from the bootloader.hex could work, but didnt tryed)
    I will try later and will report if works

    The buzzer placed as my previous design has some interesting behaviour that i was not able to explain, now i understand better what is happening and i think this deserves another message, i will try to explain later but is working better than i said, i get rid of part of the interference and im able to make different "beeps" so is not an epic fail, actually is working and it can make a loud "beep" i.e. configured at 2 PWM there is no audible pulse



    Wow great news, i will test your beta versions and report
    And a good idea of how to implement this, it seems LCDsetter is the best way to keep compatibility with simple buttons while using the same firmware for all the variations in the board design, usefull app again :)

    The output sequence is this (tested with a multimeter)

    >-------------right------------->
    10<--->00<--->01<--->11
    <-------------left--------------<

    Im using 2 bits for every step (for the 2 pins of the encoder ), but i dont know if at level code steps must be 4 bits... if are 4 bits then must be added the first 00 bits at the beggining of every step

    The "standby" positions of the dial are 10 and 01 (marked in bold), in every "click" you "jump" 2 steps, and the dial passes to the next "standby" position... there is no way to keep the whell fixed at 00 nor 11 positions (i think this can be important when implementing the gray code detection)
    In other words... you need 2 "clicks" to send the full sequence

    One click to the right: 10-00-01
    Another click to the right: 01-11-10

    One click to the left: 10-11-01
    Another click to the left: 01-00-10

    This is a drawing of the internall parts of a rotary encoder, visually is hard to understand how this mechanism can output a sequence in 2 bits, the "magic" is in the degree displacements, and precise measures of sectors and active pins width
    [​IMG]
    G= ground
    A & B= gray code pins
    * pin letters, number of whell sectors, and degree displacements of the active pins are not accurate, i draw this just an example with a photo of a whell from google images

    The one ch424 suggested initially casually is simillar than mine, both al ALPS, but different model
    http://es.rs-online.com/web/search/...Products&searchTerm=263-2930&x=34&y=20#header
    The technicall characteristics can be resumed as: +30º-30º 30 steps
    Steps=clicks, is easy to know how many steps a encoder has by counting the clicks... multiply this number *2 and you have the totall number of sectors (sometimes are identifyed using the number of sectors steps/totall as: 10/20, 12/24, 15/30, 16/32, 20/40)
    For degrees displacement of the active pins is not so easy to know

    I suppose for the other models with different number of steps the manufactures changes the degrees of the active pins to match the standard gray code output (im not 100% sure about this but i see no other way to make this detection with 2 bits so the output code must be the same for all 2bits/pins ones)

    As an example of different rotary encoders, the one used in this tutorial (GH3071-ND) is a +10º-10º 36 steps. It seems different phisically but the gray code output is the same than mine
    tutorial ----> http://www.mcmanis.com/chuck/robotics/projects/lab-x3/quadratrak.html
    dgikey part ----> http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=en&site=US&KeyWords=GH3071-ND&x=29&y=13
    datasheet (bottom of the last page) ---> http://lgrws01.grayhill.com/web1/images/ProductImages/Series 25L Encoder.pdf

    This tutorial explains how to implement the code, for the detection part it seems that only 2 steps of the sequence are needed to know which way is rotating by knowing the previous state of the pins, and the next one.
    It does the detection by sampling every X miliseconds, im not sure if this is the best idea but is an option

    Btw... when you change the dial from a standby position---> to the next standby position (1 click)... you are passing for 3 different states of the 2 pins so you can capture a totall of 6 bits (2 bits of standby state + 4 bits of the click), maybe are not needed all them, but can be used to improve detection
     
    Last edited: 23 Jun 2011
  7. Volegna

    Volegna What's a Dremel?

    Joined:
    26 Jun 2011
    Posts:
    2
    Likes Received:
    0
    Hi,

    I have read all 37 pages and i'm very interested in this project.
    I would like to make sandungas his project (i"m totally new in PICS but i have an ICD2 clone programmer and would like to experiment with it), but i have to wait until sandungas has finished his layout and till it's completely working.
    The following things would be nice to me: rotary switch that can adjust the brightness of lcd, and can select next track or previous track; IR remote control in winamp with LCD smartie.
    I would also like to build it in a PC case, so the design has to be compact to fit in 5.25 inch opening (i will use a 2rows x 16 char display or a 4rows x20 char direct mountable with a pin header or something like that).
    Currently i'm waiting untill some components arrive, then i will look what board i will etch (because there are so many designs now).
    I will follow your progressions, so keep up the good work folks.

    Greetings,

    John Volegna
    johnvolegna[at]yahoo[dot]com
     
  8. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Hi volegna, an ICD2 programmer is perfect because it works at HVP (high voltage programmer), the other kind of programmers (LVP= low voltage programmers) cant be used for this project because a PIC that has been programmed in LVP needs some hardware requisites that this board doesnt have... and cant be implemented
    So a HVP programmer is the only option... i think this can be advised in the blog because is important

    @ thaimin... as we are using HVP and a bootloader... i think is a good idea to protect the bootloader activating "bootloader code protect" config bits
    This way there is no possibility to corrupt the bootloader by problems when updating to new firmwares of when making experiments with the firmware
    With the bootloader protected there is no write access to the bootloader area of the PIC when connected from USB, the only way to overwrite it is by removing the PIC and reprogramming it with a HVP

    @ volegna... actually im using the encoder as it was only 1 direction of rotation, but thaimin is taking a look at the code trying to make it work for both directions
    I see no problem to make it work as you said if the gray code detection works
    About the IR receiver (and emmitter) there was several people talking about this in the thread, and they provided examples of other projects but there wasnt too much related to this one
    I see an IR receiver/emmitter the next "big" step for this project, but actually i think is not doable mostly because the software involved on the PC part (it must be something related to "LIIRC project" for maximun compatibility with IR remote controllers)
    Either way... i ignore if there are some technicall limitations that can make this impossible

    To fit this in a 5.25 inch PC the bigger screen size is 16x2 characters
    Well... 20x2 can fit, but the pinout of the screen dont matches my design, this boards has 2 rows of pins in a side with 8 pins each row (the same pinout than 20x4 and bigger ones)
    Search in ebay for "HD44780 16x2" and you will find several models in different colours, the one i bought is one of the cheaper ones with blue characters (around 3,5€ = 3$ with shiping from china to spain)

    You will need 2 extra buttons for my next desing, this is what i have by now, im a bit lazy with the buzzer area at the right because i need to make some tests, but the rest is finished, i think is very optimized and easyer to build, there are lot of components/traces moved and transistor traces matches the pinout of "BC547B & BC548A/B"

    [​IMG]
     
  9. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    The buzzer story (sorry for the walls-of-text guys) :sigh:

    First time i placed the PIC in the finall board i was a bit scared of LCDsetter so i just installed the firmware and get out of the app (i was wrong being scared, but the point is that i didnt experiment enought with LCDsetter to understand what GPOs configuration was)
    This way my PIC was configured (by default) with all of the five GPO's turned ON @ PWM 255
    As i placed the buzzer in my board directly connected to GPO4 this made the buzzer beep at 255 PWM permanently
    In the same way, GPO5 (connected to a led in my board) keeps lighted permanently

    Well... this was my test conditions the first time i turned ON the LCD... under this conditions is what i wrote previously about an "interference" because the buzzer beeps when the led turns on (this is what needs a better explain)
    After some tests i think are 2 different problems

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

    At 255 PWM the led is lighted permanently... and the buzzer beeps, but if you turn off the led then the buzzer turns off, but in fact is not in silence, it reacts to the lcd with a "click" when characters scrolls or changes
    This is the "real" interference that probably is affecting all the board (as thaimin explained), interesnting thing here is this interference is not affecting other components i.e. the PIC or the LCD screen, and the effect is not notable other than in the buzzer

    What i thought about this is well... there must be some kind of interference between this 2 lines (GPO4 & 5) because are very close and my board etching was so bad, so i removed the buzzer from the board for some time because the sound was annoying me and i needed to test other things (there is no way to turn on the led without turning on the buzzer)

    After some time i discovered the beautyes of LCDsetter and i saw the possibility to disable the buzzer by software so i soldered the buzzer again to test this, and i remembered what thaimin said about:

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

    What i can say after testing different PWM values is the whole range of PWM availables in the PIC code (0-255) can be divided in 3 sections from a "human audible" point of view
    0-1 ---------- silence (really turned off)
    2-253 ------- clearly audible by a human ear, some values gives plain loud sounds (the ones that matches with frequency of musicall notes), other values gives strange ¿¿¿electricall??? sounds
    254-255 ---- silence with a "click" when data is sent to the screen, but can be considered silence (very different to the range 2-253 that are clearly audible)

    The special "feature" of 254 & 255 values is that only the interference is audible (the theoricall permanent pulse dont).. so you will hear only the "clicks" (characters changes in screen and at the same time you can hear a "click")
    Is easy to reproduce, just connect a buzzer directly to GPO4 and configure it to PWN of 255 in LCDsetter and to be permanent turned ON (and turn off GPO5 as i will explain later), then open LCDsmartie and let the app send data to the LCD, this way you can hear the "clicks" when characters changes or when screen scrolls

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

    But there is a second interference that happens when you send data to the other GPO (i tested this between GPO 4 & 5... led and buzzer, im not sure if this happens in GPO1,2,3 too)
    To reproduce this... in LCDsmartie send a "blink" to GPO5 (the led) and you will hear the buzzer (in GPO4) that emits a loud sound
    This one dont seems to be a hardware interference, and is very different to the first one i explained

    There is a possibility that this comes from the PIC firmware or LCDsmartie... or the .dll plugin that LCDsmartie uses ?

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

    Apart from this strange behaviour... i think my previous drawing with the buzzer directly connected to the PIC is functionall, i managed to configure the buzzer to emit a loud "beeeep" by configuring it in LCDsetter at 2 PWM, not bad
    By testing other PWM values it seems that i can make musicall notes (this must be done by making a mathematicall calculation with a formula explained in one of the links)
    This is enought to configure the buzzer sound by now (even without calculations, just trying different values) so i thing is a better idea not to add more components between the buzzer and the PIC

    By googling i saw this "trick" to drive a buzzer with PWM was used in mobile phones i.e. "nokia ringtones" that made a standard for this melodies
    Initially i was thinking in the possibility to make some sequence of beeps with different tones, but actually i see no way to make this in LCDsmartie, and im not sure if the PIC code (or LCDsmartie plugin) can manage this
    To make music is needed another parameter for the time that the signal keeps active in every step of the sequency, something like:
    GPO5 beep @ PWM122 time=2 pause=4 (PWM= sound frequency: 2-253) (time= duration of the beep sec: 1-5) (pause= inactivity after the beep sec: 1-10)
    Nokia ringtones simplify this to something similar, i will add a few links at the end of the message that explains this better

    By now i see no way to achieve something similar, well... i can configure the sound in LCDsetter but this is intended for a permanent configuration
    And... i see no way to send different "beeps" with different PWM
    And... i see no way to manage the times (duration of the beep & pause after the beep)

    Im not sure of the technicall imitations of the code (neither the frequency range available in Mhz in the code that is needed to fit the musicall scale inside it), maybe this can be done but im noob with LCDsmartie, can somebody give me a hint or this is a road end?

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

    I was testing to add components for ADC conversion (a resistor + a capacitor of different values inside the range proposed in some examples i found) none of them made any benefit, the sound changes but i cant say that is better... is different, but similar
    [​IMG]

    Then i tested with only 1 capacitor in-line as i saw in another example of driving buzzers with PWM (not related to ADC conversion, but to "stabilish" the line) this gave me same result... sound changes but no real improvement
    http://www.beyondlogic.org/pic/ringtones.htm
    *In this link there is an explain of how nokia ringtones works, they uses a PIC to manage all
    [​IMG]

    And finally i tested with a variable resistor in-line (500ohm)... this works as a volume controll, it works fine and the range of 500ohm seems to be perfect (probably 1Kohm and bigger can be used but will give you a tinyer range of volume)
    http://hades.mech.northwestern.edu/index.php/Driving_a_piezo_speaker_with_a_PIC
    *In this link there is an explain of the mathematicall formula to fit all the notes in the frequency range
    [​IMG]

    Either way... im happy how the buzzer works by now, is good enought for simple functionality and you can change the sound in LCDsetter
    And the real interference with the "clicks" when setting the buzzer at PWM 255 is not bad (not good to be permanently activated, but maybe usefull)

    I would like to hear some oppinions before finishing my board design, but it seems i will add only the variable resistor because is the only thing working as desired
    Is the first time i play with a buzzer, im not sure if mine is a "piezo speaker" or a "magnetic buzzer"... or if there are differences when driving them

    The other option of making ADC conversion with a transistor i think can be discharted because it seems there are ways to make music with PWM... in the end it seems that PWM is giving us usefull features, and is the better option to drive a buzzer with few components, good enought





    Btw about the rotary encoder...
    I found a similar open source project in hackaday that involves a Rotary encoder, a PIC & an a LCD screen
    http://elect.wikispaces.com/XBMC+USB+Controller
     
    Last edited: 11 Jul 2011
  10. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
    First I would like to say that I made some code adjustments that should enable rotary usage. I know it took awhile, but I have been quite busy. The new firmware may have problems with it (I can't test it at all since I don't have a PIC at the moment) especially getting right and left backwards, or just outputting garbage, or in the worse case not even running anything.

    For now I am going to make it available in a temp location: http://www.coderforlife.com/temp/MCHPUSB.hex.

    Sandungas, can you test it for me? You can update the PIC using LCD-Setter with the above HEX. Once you update the PIC, the rotary encoder needs to be hooked up to inputs 1 and 2. After that, you will get "L" and "R" button presses (for left and right) in LCDSmartie (along with the regular A and B button presses). The idea here is that I wanted people to be able to use buttons OR a rotator without having to create new settings. So if you use a rotator you will only look for L and R button presses. If you want to use buttons then you look for A and B button presses. Note that for the moment it sends the L and R for every gray code change, so one "click" should be two Rs or two Ls.

    --------------------------------------------------
    Now, for the buzzer stuff

    As long as you are providing useful information (which you are), walls of text are great!

    This is definitely a strange breakdown, but good to know. It is possible that the buzzer requires oscillating current instead of constant. If you have a function generator you could test this out by sending it sine waves of different frequencies. This would explain why when the PWM is always-on the buzzer goes nuts since it is waiting for a drop in current.

    Interesting as well. How are your GPOs setup (using transistors or no transistors)? The setup could greatly effect this behavior. Also, the DLL plugin that LCDsmartie uses was created by me and is just a stripped down version of the "usb2lcd-util.dll" file that LCD-Setter uses.

    Great!

    It would probably be possible making a standard LCDsmartie plugin (using the $dll function). It would probably be tricky, but a cool idea.

    Well, it was a thought, and I never used a buzzer so I didn't really know. Glad it works without extra circuitry.

    Awesome!

    There could possibly be some major differences, but who knows?

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

    Thanks for all the discoveries! And please test out the rotary stuff.
     
  11. Volegna

    Volegna What's a Dremel?

    Joined:
    26 Jun 2011
    Posts:
    2
    Likes Received:
    0
    My home made LCD board...

    Hi folks,

    Meanwhile I have made the circuit from page1 of this forum. See pictures below. I have tested it with 2 types of LCD screens: a) 2x16 with yellow backlight and b) 4x20 with blue background.
    I'm running this on Windows 7 ultimate with LCD smartie on COM3,9600 matrix.dll. My PIC is a 18LF2550. The rotary switch is currently not connected, I haven't tested the rotary switch yet.
    The cable between my driver board and my LCD is only 5cm long.

    a) Test with 2x16 LCD (GDM1602A) yellow backlight
    Works good, although I see a very light flickering from my LCD backlight, almost not visible, which is acceptable for me. The backlight flickering timing interval appears to be about every 10 seconds.

    [​IMG]

    Backside view:

    [​IMG]

    b) Test with 4x20 LCD (JDH204) blue backlight

    [​IMG]

    As you can see, this 4x20 display has problems with scrolling lines. Fixed or static text shows ok. Does someone have the same problems like me with the 4x20 LCD ? Could it be defective?
    I also have played a bit with the "scroll" and "refresh" timing interval in LCD smartie.
    "Refresh" is set now on 50ms and "Scroll" to 900ms. That helps a little bit, but you can still see the old fading characters moving.

    1) Anyone has an idea why the refresh rate is so slow on the scrolling lines of my 4x20 LCD ?
    2) Can somebody email me (johnvolegna[at]yahoo[dot]com) the source code that Ch424 has used on the first page of the forum ? Thanks in advance.

    Best regards,

    John
     
    Last edited: 17 Jul 2011
  12. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    I had some problems when installing the firmware over the old version, i did it without rotary wires connected, im not sure if this was the problem
    In this conditions LCDsetter adds 4 "L" characters at the beggining of the first line when pressing "Read LCD current" and other times it gives an error "operation timeout", and substracts 1 "L" character at the beggining of the first line when pressing "Read LCD memory", GPO values seems not to be correct, most values seems to be taken from neighbour data in the eeprom
    I managed to corrupt the firmware (bootloader included) from LCDsetter testing this... lol
    After some "operation timeouts" LCD screen changed to blank, and no windows sounds/popups when pluggin or unpluging the device even after a windowsXP reboot
    So the bootloader was corrupted in some way related with configuracion, probably a problem with size but seems not to be important, dont worry about this, if you upload other beta firmware i will make a full install to test it

    A full install (bootloader included) with the rotary wires attached fixed all this
    Then in LCD smartie (in LCD features/last key pressed) i have a permanent "L" (or a permanent "R" depending of the position of the encoder before opening LCDsmartie) and i cant change it by rotating, other inputs seems to be "freezed"
    But if i close LCDsmartie, rotate 1 "click" and open LCDsmartie again... i can see the other value (R or L depending of the previous one)

    In LCD setter (with the rotary stopped in the same position) i can see random inputs every time i press "read buttons" most common ones:
    1, 2, 3, 4, 5
    1, 2, 3, 4
    1, 2, 3, 5
    1, 2
    1, 2, 3
    1, 2, 4

    *1 & 2 are present in all cases
    *If i disconnect the wires then "no buttons are pressed"

    At first i had the same problem and the same thought than you, is not defective but probably it depends of the quality of the manufacturing process (another effect that i think it depends of manufacturing process is the time pixels spent in fully turn off)

    You must test with different contrast values, in my experience ideal values are the closes ones to the ones when the problem appear (i.e. if you can see this problem with 150.... try with 160)
    After this you will need to adjust the backlight value to minimize the other problem (turning off times of pixels)

    Its a compromise between contrast and backlight, you will need to find the better values for your screen



    Edit:
    Sorry for the delay wth the board design, im a bit perfectionist and my board is built, but i would like to finish this better i can

    [​IMG]
    This one is my "v7_LR" design (previous one i uploaded in the thread was v2)
    "L" & "R" letters are the optionall circuits at left & right, i plan to make a totall of 4 variations of this design by removing component/traces at sides
    Most notable changes are the bigger traces/pads, and the removing of the USB-B verticall connector

    The removing of the USB-B connector was something i refused to do... but is needed to place the rotary in the center of the square made by the 4 bold holes around it, now the encoder is perfectly centered, this sketch is a view of a PC 5,25" bay from behind
    [​IMG]
    This USB PIN header will create problems with people using USB wires without shield (interferences in USB line) so be carefull... otherwise there was a request in the thread time ago for adding a USB PIN header
    Another request was to add pads for a backlight resistor, this pads are added too over Q1 transistor (but unpopulated)
     
    Last edited: 19 Jul 2011
  13. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Im still building the thing, by now ive not builded the wires for the IN pins, and i think i need a metacrilathe protector for the screen but is almost finished

    This photos are from my board (version 2) i posted here ---> http://forums.bit-tech.net/showpost.php?p=2715720&postcount=719
    Some components are a bit tweaked so is not exactly as i draw but overall is the same
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    This photos are mostly to show how the pieces must fit using columns made with bolts, nuts and washers (washers are used to controll the height, 4 washers = 1 bolt)
    Im happy with it, but there was some components too close to the nuts/holes, i had to cut one corner of a fan connector, another corner of the 3 pins connector (the one behind the rotary), to move the 2 capacitors near the LCD connector, and to place the IN connector in angle because was too close to the pic
    Additionally, i cant use washers in 3 of the holes because there are components or traces too close

    All this will be fixed in my next board design (v7 or v8) plus some additions as the centered rotary and the 2 buttons (usefulls for tests even if you plan to replace them with externall ones), all in the same size
    I dont want to confuss people with this photos, this board can be considered obsolete but photos are always better for explains than words
     
    Last edited: 21 Jul 2011
  14. sandungas

    sandungas What's a Dremel?

    Joined:
    14 May 2011
    Posts:
    12
    Likes Received:
    0
    Finally i found time to finish this, at the end of this post there is a .zip with the files of my v7 design of the board
    There are 3 variations of it:
    V7LR is the "base" design with all the components and suplementary circuits
    V7L has no components at the right but pins for the outputs (the board keeps the holes for bolts)
    V7 is the minimall with no components at left and right, but pin outputs at both sides (no holes for bolds)

    This screen captures are resized to real size (only for a preview)
    [​IMG][​IMG][​IMG]

    I wrote a "components.txt" thaimin style (i liked the way is detailed in the blog) but this is not included in the .zip because is too long to not have an error, so considere this text as suggestions

    P.D. There was a fourth variation of the board (v7R without the suplementary circuits for fans) but i think this one has no point, either way it can be done by ripping components from the base design (V7LR), originall files are provided in the .zip

    As i said in other messages, use the files and modify them freely, but please upload them in this thread with your variations to improve the project, feel free to copy the traces in other programs (as eagle) and distribute them, but dont make money with this ;)

    FILES ----------> LCD2USB+ sandungas board v7.zip
     
    Last edited: 2 Aug 2011
  15. ph-tvs

    ph-tvs What's a Dremel?

    Joined:
    21 Oct 2011
    Posts:
    2
    Likes Received:
    0
    Could some one please supply a copy of the source code for the 2550 version ?

    Thanks in advance!

    Theo
     
  16. thaimin

    thaimin What's a Dremel?

    Joined:
    24 Apr 2009
    Posts:
    40
    Likes Received:
    1
  17. ph-tvs

    ph-tvs What's a Dremel?

    Joined:
    21 Oct 2011
    Posts:
    2
    Likes Received:
    0
    @thaimin Thanks!!
     
  18. deskwizard

    deskwizard What's a Dremel?

    Joined:
    19 Nov 2011
    Posts:
    2
    Likes Received:
    0
    @thaimin

    I had to register here to thank you for the work you done with LCD2USB+.
    I built mine 2 days ago and after some tweaking (software I use was picky) I got it working perfectly. Your website was of great help while building and debugging it. I haven't installed the parts for the inputs and outputs yet, but I tested the buttons in lcdsetter last night and they were working.

    @sandungas

    I don't know if you are still around, but I also want to thank you for all the work you also put into this. It is because of your posts I decided to build my device. I had a great read on rotary encoders tonight also! ;)

    @both

    Now, with that rotary encoder thing.... is there a way to make it work?
    From what I understand, for a while you guys got it working as 2 buttons, which would be perfect for my use. Too bad the temporary firmware location is now dead.

    Let me know if there's anything that I can do! I'm willing to do as much testing as necessary of course
     
  19. rastaman46

    rastaman46 What's a Dremel?

    Joined:
    22 Oct 2011
    Posts:
    15
    Likes Received:
    1
    can it work with TC2004A-02?

    Im got it build can load boot loader but once im install firmware its not even shows on pc

    Thanks
     
  20. dvo

    dvo What's a Dremel?

    Joined:
    23 Jan 2012
    Posts:
    1
    Likes Received:
    0
Tags:

Share This Page