1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Problem with 7-segment display

Discussion in 'Arduino' started by mauros, Apr 25, 2017.

  1. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    I built a (foot)controller to send midi messages via bluetooth to usb port of my guitar multifx and at a later time I wanted to add a 7-segment display to view the counter of the selected effect.

    Unfortunately, in the sketch, after inserting

    #include <SPI.h>
    #include <Usb.h>
    #include <usbhub.h>
    #include <usbh_midi.h>
    USB Usb;
    USBH_MIDI Midi (& Usb);

    the presence of the code
    If (Usb.Init () == -1) {while (1);}

    causes problems in displaying 7-segment display digits.

    The display is this https://tinyurl.com/ku3cojj ( 2 digits in one )

    The problem appears if i connect the 7 segments between pin 5 and pin 11 (driving digit 1 with pin 12 and digit 2 with pin 13), and at that point the digits are not well distinguished because the segments that should remain turned off remain turned on. Unfortunately, pins 0,1,2,3,4 are used for other purposes and I can only use from 5 to 13.

    I tried to remove all the "include" mentioned above but only with the presence of the code

    If (Usb.Init () == -1) {
    While (1);}

    the digits display is faulty !

    However, if I disable the code
    If (Usb.Init () == -1) {
    While (1);}

    i have no problems with the display BUT the controller does not work :-D

    Can it be solved ?

    Thanks in advance !
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    Doesn't appear to be an Arduino sketch... What chip are you using??? Is the 7 segment on a shield?
     
  3. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    I'm using ATMEGA 328P
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK

    It hasn't got a USB port.. The USB is connected via ttl->usb convertor... Are you using an external USB hub??
     
  6. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    It is most probably caused by the MOSI and MISO on pins 12 and 13 also SS on pin 10.. where the USB shield is probably connected..

    Why can't you use pins 0,1,2,4,
     
  8. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    Pin 0,1,2,4 used for:

    Pins 0 for TX e pin 1 for RX
    Pins 2,3 and 4 connected to 3 buttons
     
  9. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    On the back of the Arduino is a six way header.. This houses SPI 2.. Can you use these pins???
     
  10. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    I do not understand what pins you're referring to
     
  11. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
  12. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    I'll read later
     
  13. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    upload_2017-4-26_13-2-9.png
     
  14. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    In fact the analog pins are engaged even those except A5 that in fact i use instead of pin A11 or A12 or A13
     
  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    What 7 segment shield have you got?? Using the two seial pins with shift registers may be a better option!
     
  16. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    So far I've tried with a dual display with 7 segments shared, good only if I used pins 2,3,4,5,6,7,8 (9,10 for enable the two digits) but i had to handle the alternate 2-digit with switch on and off. I just got a 2-digit display with two 2x 74HC595.
    It would be interesting to be able to use some pins of the USB Interface ICSP but I would not know how to do it.
     
  17. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    That's how I would do it... You only need three pins... CLK, DATA and CS much easier...
     
  18. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    Today I wired two 74HC595 with 2 displays but after connecting a myriad of wires it did not work well and I disassembled everything, also because i had already made two pcb with 2 shift registers and one pcb with two transistors in multiplexing but i got the problems i have written here. I would like to be able to buy a module like this http://www.ebay.com/itm/401171797073?rmvSB=true but in Europe and not in China, to not wait a month and even more
     
  19. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    I make large displays 3' 1/2" character using 74hc595 and ULN2003 drivers...
     
  20. mauros

    mauros Member

    Joined:
    Apr 25, 2017
    Messages:
    55
    Likes:
    0
    Unfortunately currently I do not have much time to manipulate with electronic componentsto or create the pcb, even though I am equipped and at the moment It is better for me to buy a module already ready to be used like this http://www.ebay.com/itm/401171797073?rmvSB=true. If you know some shop in Europe, let me know
     

Share This Page