Announcement

Collapse
No announcement yet.

VDI-RODERICO

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

  • roderico
    replied
    Originally posted by Sacchetti View Post
    Sorry, I have done all too fast, there was some mistakes. These are the "issue 1" schematics: [ATTACH]39816[/ATTACH] [ATTACH]39817[/ATTACH] I think they are correct, please check them. The following instead are wrong therefore don't use them:
    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...

    Leave a comment:


  • Sacchetti
    replied
    Sorry, I have done all too fast, there was some mistakes.

    These are the "issue 1" schematics:
    VDI.pdf
    VDI_BL.pdf
    I think they are correct, please check them.

    The following instead are wrong therefore don't use them:
    Attached Files

    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...
    Hi Roderico!
    Please, check also this attached schematic!
    Please, can you add backlight control in the software? Thank you.
    Obviously, it is only for who has good battery...

    "Backlight -> RB0"
    VDI_BL.pdf

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

    VDI.pdf

    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...
    To test it I need the opamp, I can try to use another one because I haven't it that in schematic.
    I am going to prepare a schematic as you request. Please wait.

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico,
    thank you.

    I know the necessity to add a Xtal (I have a lot of 4MHz) plus 2 little caps or directly an hibrid oscillator because the '876 doesn't have internal Osc.

    I haven't problems to change the software for this micro but I can not do it immediately.

    Which problem do you encountered with the A/D code?
    The resolution is the same, can be the register usage will be different therefore as soon as possible I will read the datasheets of both pic to compare them.
    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...
    Attached Files

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi Roderico,
    thank you.

    I know the necessity to add a Xtal (I have a lot of 4MHz) plus 2 little caps or directly an hibrid oscillator because the '876 doesn't have internal Osc.

    I haven't problems to change the software for this micro but I can not do it immediately.

    Which problem do you encountered with the A/D code?
    The resolution is the same, can be the register usage will be different therefore as soon as possible I will read the datasheets of both pic to compare them.
    Hi Sacchetti, PIC16F876 will work fine, the code will only need to be adapted and recompiled, it is not difficult, I can help with that. There is no problem with the ADC, as you mentioned the registers need to be adapted for this model. To adapt the code, first you need the circuit schematics, e.g. X -> RA0, Y-> RA1, battery meter could also go in RA3, then LCD can be connected to RB4-RB7, switches SW1-3 to RB0-2 which have internal pull-ups and the crystal to pins 9 and 10, if you could post the complete schematics would be very good, I can modify the code and recompile it for you to test it...

    Leave a comment:


  • Sacchetti
    replied
    Originally posted by roderico View Post
    Hi, current hex files won't work for this model, for each model you need to recompile the source code after defining the pins, adapting the A/D converter code, etc. and in this case, you would also need an external 4MHz oscillator if timings are not changed in the code for different oscillator frequency...
    Hi Roderico,
    thank you.

    I know the necessity to add a Xtal (I have a lot of 4MHz) plus 2 little caps or directly an hibrid oscillator because the '876 doesn't have internal Osc.

    I haven't problems to change the software for this micro but I can not do it immediately.

    Which problem do you encountered with the A/D code?
    The resolution is the same, can be the register usage will be different therefore as soon as possible I will read the datasheets of both pic to compare them.

    Leave a comment:


  • roderico
    replied
    Originally posted by Sacchetti View Post
    Hi!
    Who has used PIC16F876 instead?
    I have some spare...

    Is the hex file already ready for this micro using LCD?
    Hi, current hex files won't work for this model, for each model you need to recompile the source code after defining the pins, adapting the A/D converter code, etc. and in this case, you would also need an external 4MHz oscillator if timings are not changed in the code for different oscillator frequency...

    Leave a comment:


  • Sacchetti
    replied
    Hi!
    Who has used PIC16F876 instead?
    I have some spare...

    Is the hex file already ready for this micro using LCD?

    Leave a comment:


  • roderico
    replied
    VDI LED v1.2

    Originally posted by roderico View Post
    I compiled a new version removing the trigger delay for quicker response, reported by Artyom. I had to add a pull-up resistor of 10K between MCLR pin and Vdd because it added some noise to the A/D when turning off a led (even being disabled in the configuration). I also added up to 4 leds (perkun's idea), so you only need to replace the firmware (and/or some leds) to change between different versions.

    2 led firmware:

    D1 on for -60 < vdi < 0
    D2 on for 0 <= vdi < 90
    D1 and D2 on -> op-amp in saturation and alternating on/off for calibration
    D3 and D4 not used (no need to be in the pcb)

    4 led firmware:

    D1 on for -60 < vdi < 0
    D2 on for 0 <= vdi < 20
    D3 on for 20 <= vdi < 45
    D4 on for 45 <= vdi < 90
    D1 and D2 on -> op-amp in saturation and alternating on/off for calibration

    I tested both with a PIC16F88 but it should work with PIC12F683/675. In the attached files there is also an example pcb layout that could be used for this vdi:
    I got some PIC12Fxxx's and made a small test. Unfortunately, they didn't work as expected (like the PIC16F88 ). The channels X and Y were swapped in the schematics but not in the firmware and PIC12F683 A/D converter was not working properly. I fixed these issues and compiled a new version which worked well in the tests I did (attached below).

    For PIC12F675 you need to take care of not to erase the internal oscillator calibration data, there should be an option in your programmer, or answer no to overwrite the data at the time of programming. You can also write down the calibration value before writing the firmware in case you accidentally erase it (it is in the address 0x3FFF and should start with 0x34).
    Attached Files

    Leave a comment:


  • roderico
    replied
    Originally posted by roderico View Post
    Here it is the version with the trigger delay adjustable in the configuration menu to set a faster response. To remove the delay as in the led version you need to set it to 0ms and to recover the previous version value you need to set the delay to 500ms. This version also discards some cases where the sampling is incomplete and gives wrong vdi numbers (I'm using a 10k resistor between MCLR pin and Vdd in my vdi, however I haven't tested the firmware without the resistor while reducing the delay to 0).
    This version has the default VDI interval in [-90,90], however, if you cannot see silver (i.e. vdi>90) then you need to change it back to [-90,180]

    Leave a comment:


  • roderico
    replied
    VDI LCD v1.3

    Here it is the version with the trigger delay adjustable in the configuration menu to set a faster response. To remove the delay as in the led version you need to set it to 0ms and to recover the previous version value you need to set the delay to 500ms. This version also discards some cases where the sampling is incomplete and gives wrong vdi numbers (I'm using a 10k resistor between MCLR pin and Vdd in my vdi, however I haven't tested the firmware without the resistor while reducing the delay to 0).
    Attached Files

    Leave a comment:


  • roderico
    replied
    VDI LED v1.1

    I compiled a new version removing the trigger delay for quicker response, reported by Artyom. I had to add a pull-up resistor of 10K between MCLR pin and Vdd because it added some noise to the A/D when turning off a led (even being disabled in the configuration). I also added up to 4 leds (perkun's idea), so you only need to replace the firmware (and/or some leds) to change between different versions.

    2 led firmware:

    D1 on for -60 < vdi < 0
    D2 on for 0 <= vdi < 90
    D1 and D2 on -> op-amp in saturation and alternating on/off for calibration
    D3 and D4 not used (no need to be in the pcb)

    4 led firmware:

    D1 on for -60 < vdi < 0
    D2 on for 0 <= vdi < 20
    D3 on for 20 <= vdi < 45
    D4 on for 45 <= vdi < 90
    D1 and D2 on -> op-amp in saturation and alternating on/off for calibration

    I tested both with a PIC16F88 but it should work with PIC12F683/675. In the attached files there is also an example pcb layout that could be used for this vdi:
    Attached Files

    Leave a comment:


  • Artyom
    replied
    Originally posted by roderico View Post
    I had a look to the code and removed the longer delays, now it works much better, however I need to do a few more tests. In order to remove those delays I had to add a resistor so the pcb layout needs to be changed. I'll also try to backport the code to the LCD version and then I would post them here...
    Do not hurry, share the results and together we will make a worthy indicator.

    Leave a comment:

Working...
X