Announcement

Collapse
No announcement yet.

VDI-RODERICO

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sacchetti
    replied
    Originally posted by roderico View Post
    yes that was what I meant. It would be very good if you could test the firmware and check the code and/or if you find bugs and or have improvements would be also very good
    I agree.

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    I bought some of them in ebay (Yellow/Green) and they are working fine for me and it only says 1602A on the PCB, however I'm not using the backlight thank you for the datasheet...
    This datasheet is more reliable.

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi again, I adapted and recompiled the code using this pin configuration:

    Analog inputs:

    X -> RA0
    Y -> RA1
    BAT -> RA3

    Switches:

    SW1 -> RB3
    SW2 -> RB2
    SW3 -> RB1

    LCD:

    RS -> RC7
    RW -> GND
    EN -> RC6
    DB0-3 -> GND
    DB4 -> RB4
    DB5 -> RB5
    DB6 -> RB6
    DB7 -> RB7

    The attached file contains an unoptimized firmware only for testing, If I'm not mistaken it should work. It would be good if you could post the schematics for debugging using the above connections...
    I am going to try to compile it...

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    With the pull-up resistor the MCLR is guaranteed that it is in logical 1 instead of floating which in some cases might cause some unexpected problems. In the other pics is disabled, this model is different but I couldn't find in the data sheet if it has an internal pull-up or not so you might not need to add a pull-up resistor. Also check

    I attached below the specific code I used for generating the test firmware for your pic in case you would like to change the configuration options (e.g. to enable PWRT) and do some other tests:
    Hi Roderico,
    the pull-up resistor was used in the past with PIC having only POR.
    This one (F876) has also PWRT and OST therefore is not more necessary if you use them.
    You must connect the resistor only if you continue to use POR but it is worst, it is better to use PWRT or OST.
    I prefer to attach the page where is explained.
    page 124 of 16F876 datasheet.pdf

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    You wrote:
    "Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V?"
    Sorry, I didn't take it immediately.

    You are right, in MD as IDX, TGS, ELDO, etc. the 8V regulator is present.
    It is possible connect it to 8V because 78L05 has about 2V dropout.
    But you must use one wire more.

    The PIC plus the OpAmp plus the LCD absorb few mA then 78L05 doesn't heat up.
    However I prefer to check with a prototype.
    yes that was what I meant. It would be very good if you could test the firmware and check the code and/or if you find bugs and or have improvements would be also very good

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico!
    Reading your datasheet I can think you are using a chinese bulk 1602A.
    It is possible to found them in ebay at very low price.
    If you do a search in internet then you can found also this datasheet for the same LCD!
    [ATTACH]39819[/ATTACH]

    Therefore, are you sure that you are reading the right datasheet?
    There is printed a brand name on PCB?
    If you are not sure at 100%, it is better to use this datasheet.
    Going to page 11, 12, 13 and 14 you can found many informations.
    The voltage and current of backlight led are different and they depends from colours and not only.

    Using 5V without a resistor, also of some ohm, instead of 4,2V or less, can work the same but you risk to damage the led.
    1602A Yellow/Green array LCD has 4,2V with 100mA led,
    1602A White/Blue edge LCD has 3,4V with 20mA led,
    1602A Yellow/Green edge LCD has 3,9V with 20mA.

    To beginners:
    Who don't know the led then it is better to start from a bigger value and after reduce it, if the light is low.
    It is not important to rise the maximum light, if the luminous intensity is enough you reduce the battery consumption .
    I bought some of them in ebay (Yellow/Green) and they are working fine for me and it only says 1602A on the PCB, however I'm not using the backlight thank you for the datasheet...

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico!
    I am looking the source code to understand how it is used the ADC and you are right!

    In this case the Vref is 5V and the end of scale using 20K/6K8 ratio is 19,4V.
    You have found this value in the file "mcu.h".
    This is the line:
    uint8_t g_adc_bat_scale = 0xC2;
    Therefore there calculating 19.4/26800*6800 we have about 4,922V.
    Using the code V1.3 there isn't modification to do using a battery voltage up to 19,4V and 20K/6K8 as R1/R2.

    But if we would obtain an end of scale of 20V then we must change the line in this way:
    uint8_t g_adc_bat_scale = 0xC8;
    Therefore there calculating 20.0/40000*10000 we have 5V.
    Then we can use my schematic with 30K/10K as R9/R10.
    This solution reduce the flow current in R9/R10 (they are R1/R2 in your schematic).
    The 30K resistor exist as E24 (5%) while as E96 (1%) we can found 30K1 but it is the same.

    Using 20K/10K the end of scale can be regulated to 15V but it is too low.
    Instead having 19,4V or 20V both end of scale are without the risk to damage the input pin, using a 12V battery.
    Therefore I have changed the value of R9 to 30K in my schematic but I prefer wait to publish it.
    I would like to test all before.

    You wrote:
    "Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V?"
    Sorry, please can you explain better?

    I am trying to recompile the code with the microchip C 8 bit compiler.
    Do you have used the free, the 60 days license, do you have bought the license or do you have used ... something else?
    g_adc_bat_scale can be changed in the menu so that the adc reading and the battery voltage match. This is necessary because of resistors tolerance as you mentioned and other components. If you are using different resistors than 20K/6K8 then the actual reading and the battery voltage would be very different but it might be calibrated with the menu (which changes g_adc_bat_scale). However it can be tuned in the firmware for your case with the value you calculated.
    I used the 60 days license for enabling the optimizations (I don't have much time left to expire) but as your pic has more space than the others there is no problem for using the free mode for testing.

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico!
    About the pull-up resistor on MCLR, please read datasheet on page 124.
    It is better you download it directly from microchip to be sure we are reading the same and the last.
    You are right if the micro is configured for use POR, but I prefer to use PWRT or OST.
    In this case PWRT is enough for example.
    Doing in this way there isn't necessity to add the resistor.
    Therefore I am going to check the source code release 1.3 for 16F88 and 16F690 to see how is configured.
    With the pull-up resistor the MCLR is guaranteed that it is in logical 1 instead of floating which in some cases might cause some unexpected problems. In the other pics is disabled, this model is different but I couldn't find in the data sheet if it has an internal pull-up or not so you might not need to add a pull-up resistor. Also check

    I attached below the specific code I used for generating the test firmware for your pic in case you would like to change the configuration options (e.g. to enable PWRT) and do some other tests:
    Attached Files

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico! About the "4 bit bus mode" the data line DB0-3 are not used. I have seen you are using an MCP1703 and an LCD without backlight. I think that both choices was done to reduce current consumption. But if your objective is to reduce the consumption to the minimum then you cann't connect DB0-3 to GND because you increase it. Every line source current and in a quantity that depends from technology used to build the chip. In many chinese datasheet this information is not present, however sometime it is present. As soon as I found one then I add this one in this thread to show you. However, I have found some chip to do -1uA for every line and some chip do -250uA or -500uA. You can check this using a good (fine) multimeter in the lower mA scale and connecting every pin to GND. At the end, for example, in the worst condition you have by useless -500uA x 4 = -2mA of consumption more!
    Hi Sacchetti, the reason to suggest to ground DB0-3 is to guarantee that their status is always in logical 0, however if you have found that it consumes 2mA more it is better not to ground them, since it appears not to cause any problem if they are not, I'll answer the other comments below..

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi Sacchetti, to me it looks fine and would match the test firmware, however I would connect DB0-3 to GND and add a pull-up resistor to pin 1 (MCLR) -- 10K -- Vdd. The battery meter is just a voltage divider, if you are changing the resistor's value you might also add a 5.1V diode to protect the pic in case you make a mistake. If I'm not mistaken, using 10K for R10 would scale [12V-9V] to [4V,3V] while using R10 = 6K8 you'll have [3V,2.28V] the difference is small but safer and it is not required too much precision here, in any case you might be able to adjust the scaling factor in the menu without changing the code when using 10K. Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V? In any case with your current schematics the test firmware might work so please give it a try and then it can be fixed if it does not work. For the BL I might need to see but for the other pics there is no much space left...
    You wrote:
    "Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V?"
    Sorry, I didn't take it immediately.

    You are right, in MD as IDX, TGS, ELDO, etc. the 8V regulator is present.
    It is possible connect it to 8V because 78L05 has about 2V dropout.
    But you must use one wire more.

    The PIC plus the OpAmp plus the LCD absorb few mA then 78L05 doesn't heat up.
    However I prefer to check with a prototype.

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    In my case, I'm using a generic 1602 display, similar to this:

    and for the backlight it is only required +5V and usually the recommended resistor is given, anyway I'm not using the backlight...
    Hi Roderico!
    Reading your datasheet I can think you are using a chinese bulk 1602A.
    It is possible to found them in ebay at very low price.
    If you do a search in internet then you can found also this datasheet for the same LCD!
    LCDD-01-datasheet.pdf

    Therefore, are you sure that you are reading the right datasheet?
    There is printed a brand name on PCB?
    If you are not sure at 100%, it is better to use this datasheet.
    Going to page 11, 12, 13 and 14 you can found many informations.
    The voltage and current of backlight led are different and they depends from colours and not only.

    Using 5V without a resistor, also of some ohm, instead of 4,2V or less, can work the same but you risk to damage the led.
    1602A Yellow/Green array LCD has 4,2V with 100mA led,
    1602A White/Blue edge LCD has 3,4V with 20mA led,
    1602A Yellow/Green edge LCD has 3,9V with 20mA.

    To beginners:
    Who don't know the led then it is better to start from a bigger value and after reduce it, if the light is low.
    It is not important to rise the maximum light, if the luminous intensity is enough you reduce the battery consumption .

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi Sacchetti, to me it looks fine and would match the test firmware, however I would connect DB0-3 to GND and add a pull-up resistor to pin 1 (MCLR) -- 10K -- Vdd. The battery meter is just a voltage divider, if you are changing the resistor's value you might also add a 5.1V diode to protect the pic in case you make a mistake. If I'm not mistaken, using 10K for R10 would scale [12V-9V] to [4V,3V] while using R10 = 6K8 you'll have [3V,2.28V] the difference is small but safer and it is not required too much precision here, in any case you might be able to adjust the scaling factor in the menu without changing the code when using 10K. Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V? In any case with your current schematics the test firmware might work so please give it a try and then it can be fixed if it does not work. For the BL I might need to see but for the other pics there is no much space left...
    Hi Roderico!
    I am looking the source code to understand how it is used the ADC and you are right!

    In this case the Vref is 5V and the end of scale using 20K/6K8 ratio is 19,4V.
    You have found this value in the file "mcu.h".
    This is the line:
    uint8_t g_adc_bat_scale = 0xC2;
    Therefore there calculating 19.4/26800*6800 we have about 4,922V.
    Using the code V1.3 there isn't modification to do using a battery voltage up to 19,4V and 20K/6K8 as R1/R2.

    But if we would obtain an end of scale of 20V then we must change the line in this way:
    uint8_t g_adc_bat_scale = 0xC8;
    Therefore there calculating 20.0/40000*10000 we have 5V.
    Then we can use my schematic with 30K/10K as R9/R10.
    This solution reduce the flow current in R9/R10 (they are R1/R2 in your schematic).
    The 30K resistor exist as E24 (5%) while as E96 (1%) we can found 30K1 but it is the same.

    Using 20K/10K the end of scale can be regulated to 15V but it is too low.
    Instead having 19,4V or 20V both end of scale are without the risk to damage the input pin, using a 12V battery.
    Therefore I have changed the value of R9 to 30K in my schematic but I prefer wait to publish it.
    I would like to test all before.

    You wrote:
    "Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V?"
    Sorry, please can you explain better?

    I am trying to recompile the code with the microchip C 8 bit compiler.
    Do you have used the free, the 60 days license, do you have bought the license or do you have used ... something else?

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi Sacchetti, to me it looks fine and would match the test firmware, however I would connect DB0-3 to GND and add a pull-up resistor to pin 1 (MCLR) -- 10K -- Vdd. The battery meter is just a voltage divider, if you are changing the resistor's value you might also add a 5.1V diode to protect the pic in case you make a mistake. If I'm not mistaken, using 10K for R10 would scale [12V-9V] to [4V,3V] while using R10 = 6K8 you'll have [3V,2.28V] the difference is small but safer and it is not required too much precision here, in any case you might be able to adjust the scaling factor in the menu without changing the code when using 10K. Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V? In any case with your current schematics the test firmware might work so please give it a try and then it can be fixed if it does not work. For the BL I might need to see but for the other pics there is no much space left...
    Hi Roderico!
    About the pull-up resistor on MCLR, please read datasheet on page 124.
    It is better you download it directly from microchip to be sure we are reading the same and the last.
    You are right if the micro is configured for use POR, but I prefer to use PWRT or OST.
    In this case PWRT is enough for example.
    Doing in this way there isn't necessity to add the resistor.
    Therefore I am going to check the source code release 1.3 for 16F88 and 16F690 to see how is configured.

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi Sacchetti, to me it looks fine and would match the test firmware, however I would connect DB0-3 to GND and add a pull-up resistor to pin 1 (MCLR) -- 10K -- Vdd. The battery meter is just a voltage divider, if you are changing the resistor's value you might also add a 5.1V diode to protect the pic in case you make a mistake. If I'm not mistaken, using 10K for R10 would scale [12V-9V] to [4V,3V] while using R10 = 6K8 you'll have [3V,2.28V] the difference is small but safer and it is not required too much precision here, in any case you might be able to adjust the scaling factor in the menu without changing the code when using 10K. Although you save a pin connecting 12V directly to the voltage regulator would it be better than going from 8V to 5V? In any case with your current schematics the test firmware might work so please give it a try and then it can be fixed if it does not work. For the BL I might need to see but for the other pics there is no much space left...
    Hi Roderico!
    About the "4 bit bus mode" the data line DB0-3 are not used.

    I have seen you are using an MCP1703 and an LCD without backlight.
    I think that both choices was done to reduce current consumption.
    But if your objective is to reduce the consumption to the minimum then you cann't connect DB0-3 to GND because you increase it.

    Every line source current and in a quantity that depends from technology used to build the chip.
    In many chinese datasheet this information is not present, however sometime it is present.
    As soon as I found one then I add this one in this thread to show you.
    However, I have found some chip to do -1uA for every line and some chip do -250uA or -500uA.
    You can check this using a good (fine) multimeter in the lower mA scale and connecting every pin to GND.
    At the end, for example, in the worst condition you have by useless -500uA x 4 = -2mA of consumption more!

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    The attached file contains the new schematic. Please check it.

    About R12 it must be calculated. It depends from which LCD you are using.
    Read the datasheet and search for Vled and Iled of backlight.
    Having a 3,2V and 40mA then the value is 220ohm but it is better to use 270ohm to limit current.
    Some display for example has 4,2V and 35ma then the value is the same but it is important to check always the datasheet.
    To beginners: the formula is R = (Vbat - Vled) / Iled, W = (Vbat - Vled) * Iled
    Example:
    R=(12V-4,2)/0,035=229 but we will use a bigger value (270ohm) because the battery when is full charged is more of 12V.
    W=0,273 but we use double power (0,5W) or more. For experience it is better to use 1W here.

    About the ratio R9/R10 it divide by 3 the voltage (15 / 3 = 5V).
    Sorry, I haven't read the source code therefore I don't know if it is correct.
    With a 12V battery full charged there are 14,4V then I have calculated this ratio to get 15V as "end of scale".
    In this way there is the maximum precision reading the battery voltage but can be there is to modify the software.

    [ATTACH]39812[/ATTACH]
    In my case, I'm using a generic 1602 display, similar to this:

    and for the backlight it is only required +5V and usually the recommended resistor is given, anyway I'm not using the backlight...

    Leave a comment:

Working...
X