+ Reply to Thread
Page 5 of 5 FirstFirst 12345
Results 161 to 184 of 184
  1. #161
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    FWIW. I know its great to have 'scope (I don't) but it seems to me that if you are playing with ucontrollers of whatever flavour a logic analyser is of much more value (and at significantly less cost). I will capture singleshot events just as easily as a DSO.

    You can get a Saleae clone on ebay for £5, it'll decode a whole slew of protocols. Just my 2 cent.
    George

  2. #162
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, Thanks.... I took a look and saw a couple videos the Saleae logic analyzer looks pretty cool for sure. I see them on ebay cheap too. Certainly could come in handy I am going to have to pick one up. I hooked up my scope just to see what the serial data was going to look like not so much I wasn't sure it was working but just to see because I never looked before.
    P.S. I got that Tektronix from Craigslist for $100. It had been recently calibrated (It had a security label, on of those kind you try to remove it and it voids it, from Tektronix with a date on it so I knew it was recent) IT's older but all 4 channels worked and it came from a company not an individual. The Company had got new scopes they had 4 of these and wanted to get them off their benches.
    I got one of these scopes off Ebay for my son for $70. it's older but real easy to use.
    Thanks
    David

  3. #163
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    Those are some good deals, if I could get a scope for $70 I'd take your arm off. Unfortunately (but in so many ways fortunately) I'm and Englishman living in Ireland, the market for electronics is small, causing prices to be high. But having said that the only thing an LA won't do that a scope will, is display volts in the vertical axis, other than that it's functionally an extremely expensive DSO (and it doesn't use and desk space).
    George

  4. #164
    Join Date
    Jan 2009
    Posts
    285

    Default Re: PIC USB HID breakout board

    Hi George, I picked up a clone LA a while back. What software do you use?

    Thanks

  5. #165
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, sorry to hear it's expensive and a little harder to come by there in IRE. Of course you take a chance on used equipment on Ebay too that's why I like craigslist here in the states so I can narrow my search to equipment local and you can arrange to see/test the equipment most times before you actually pay for it, less risky getting a lemon. True about the desk space too. My last pic you can see the scope takes up almost half my work desk. I really am liking this LA I've got one in my shopping cart now on ebay. For $6 you can't go wrong. I'll keep posting my progress a I work towards an alternative solution to the 18F25K50 using pic with UART and the HT42B584. I've not seen the 584 commercially available yet and I want to use the 10 pin version as I don't need functions the other pins provide, they only sent me 16 pin samples and the breakout board sample is using the 16 pin too. Interestingly I am trying to see if I can see when the caps/num/scroll keys are pressed/passed through the UAURT but it doesn't appear to be. If I press the caps lock on my keyboard the LED on the break out board for caps lock lights however that does not appear to be passed to the PIC on TX at least I am not seeing it yet. From the data sheet it does say that it is full duplex so I would expect to see it but I am not.

  6. #166
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    I use Saleae own, don't feel guilty (I don't. not one bit, if you use a reference design as your product, peeps are gonna use your software) because Saleae no longer make that model. Version 1.2.29 is pretty good.

    You can use Sigrock/Pulseview if you're uptight about copyright.

    Save me reading the whole thread, what is it you are trying to acheive?
    George

  7. #167
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    Hi George, I'm working on a sonar sensor for a kiosk application. The goal (which I've achieved with the 18F25K50) is to send some text through the keyboard HID that will awaken the kiosk as someone moves towards it. I was finished with my design and just about to order the circuit boards when Holtek emailed me and said they had a new chip coming out. I decided to hold back ordering the boards and try out the new chip to see how it worked out. I wanted to explore using UART on PIC instead of having all the USB code necessary in the 18F25K50. It's a very simplistic design when person approaches the PIC sends "wakeup" through the keyboard HID which is read by the javascript on the web page (the kiosk application is browser driven html/javascript) So when the javascript detects the "wakeup" text the slideshow that may be currently running is stopped and the welcome screen appears. If the slideshow is not playing the sonar is just ignored. Using HID compliant USB device allows me to develop this without having any type of extra software running on the client PC. I'm at a crossroad now. Which PIC/design to use given both work equally as well. Cost is not a factor. I'm probably going to stick with my original 18F25K50 ultimately there would be less components to solder.
    David

  8. #168
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    Well that seems clear but what I don't understand is why you would bother with the Holtek device? You still need a PIC of some flavour. so why even consider not going with the 25K50? Sound like an interesting project.
    George

  9. #169
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, Your right still need a pic. Just checking out what other options for this project would be available other than the 25K50. The 25K50 takes a good bit of code to work with the USB and much of it I was/am not familiar with as much as I am working with UART. At this point I am probably sticking with the 25K50. I wanted to at least document in this thread for others that there are other options available for those that may have difficulty with the 25K50 or other device(s) that require a lot of code that's not as easy to follow as the simple "hserin" The Holtek device simplifies the project code wise but is not going to be my choice now.
    Thanks
    David

  10. #170
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    I wanted to at least document in this thread for others ............
    Point taken.
    George

  11. #171
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    I ordered my circuit board(s) today from oshpark.com I should get them in a week or so. For now and until Internet Explorer supports USB with the web API I'm going to have to go to this uni directional approach which is just sending to my web page via the HID Keyboard a static phrase when the proximity sensor is triggered. I've used a series of jumpers to allow the end user(s) to select the distance at which they want to "wake up" and amount of time the sensor needs to be triggered/on state before sending my static phrase.

  12. #172
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    I'm not sure if this is helpful but on the few occasions if used HID keyboard to perform some app on the PC, I've invoked the app by sending the "r" "winkey" combination, followed by the name of the app and a CR. Works very well, doesn't rely on Java or Hotkeys, it just works. For example I wanted to invoke an mp3 player from a remote so I
    GoSub SendKey[keyr, LeftGUIMask] ' r - invoke Windows GUI command line interface
    DelayMS 100 ' Wait a little
    '
    GoSub SendKey[keyf, NoModifier] ' (f)oobar200.exe
    GoSub SendKey[keyo, NoModifier] ' (o)
    GoSub SendKey[keyo, NoModifier] ' (o)
    GoSub SendKey[keyb, NoModifier] ' (b)
    GoSub SendKey[keya, NoModifier] ' (a)
    GoSub SendKey[keyr, NoModifier] ' (r)
    GoSub SendKey[keytwo, NoModifier] ' (2)
    GoSub SendKey[keyzero, NoModifier] ' (0)
    GoSub SendKey[keyzero, NoModifier] ' (0)
    GoSub SendKey[keyzero, NoModifier] ' (0)
    GoSub SendKey[keyperiod, NoModifier] ' (period)
    GoSub SendKey[keye, NoModifier] ' (e)
    GoSub SendKey[keyx, NoModifier] ' (x)
    GoSub SendKey[keye, NoModifier] ' (e)
    GoSub SendKey[keyenter, NoModifier] ' (enter)
    FWIW complete access to any USB device is available through standard Win32 calls. Although having said that isn't the idea of using simulated keyboard input a way to remove yourself from the need for lower level programming?
    Last edited by towlerg; - 18th September 2019 at 13:02.
    George

  13. #173
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, Good information there I will remember this. The problem is that for my project we have a kiosk (pc) which is running a browser (IE or Chrome) and it's running a web page. IE does not have access to any serial ports or USB or any of the lower level win32 api calls. The kiosk is sitting in a lobby displaying a slide show (every 5 seconds or so we change the picture being displayed on the kiosk). The web page is sitting there waiting for someone to touch the screen or a signal from my sensor (pic project) There is a loop in my web page written in javascript waiting for input from the keyboard or someone to touch the screen (either stops the slideshow and displays a welcome screen which says something like please scan your bar code)

    Ultimately I don't actually want to send anything via the keyboard but since a web page running javascript, html, html5, doesn't have access to anything (serial, usb, win32 api) I'm kind of stuck at the moment that is of course if I were to write an active-x control and use the web api for chrome to access the usb then I could get away from having to use the HID keyboard method of slamming text in there. It's all about timing too... if you wanted a web page to do something like continuously poll the USB device you have to set up a timer to do that and then you have to keep track of it not hard just have to keep track of all of the timers you use, etc... I do eventually want to get away from the keyboard method because that would allow me to set up a way to let the person parameterize the settings, distance and timing, etc. via a setup web page (or .exe) instead of using jumpers which requires them to take it apart and get in there to swap jumpers.

    Once I have my keyboard prototype completed and packaged I'm going to start to work on the same project but utilizing normal serial (USB) method I will write the active-x control so my web page can communicate with it and the html5 code for Chrome. Once IE becomes compliant I can dump the active-x control and the check if you are running chrome or IE and everything will be good.

    I do appreciate everybody's feedback here please keep the ideas and thoughts coming it's very helpful. This has been a good learning experience with something new I am learning about PIC's. I hope it helps others out too.
    David
    Last edited by DavyJones; - 19th September 2019 at 12:41.

  14. #174
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    Out of the box abit (actually a good bit). Add a mouse HID and simulated mouse input to control IE.
    George

  15. #175
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, That's actually a good idea. I only need the PIC to indicated a single event has occurred when the proximity detector detects a presence. A mouse click event on the screen would do the same thing as touching the screen, it would turn the slideshow off.

    The real difficulty I face with the HID keyboard/mouse approach is that during the normal flow of presenting the user with a series of questions and expecting them to type in answers into textboxes (via mouse click events to onscreen keyboard/buttons) or clicking buttons on the screen and no way to send anything back to the PIC to stop sensing any false inputs (person shifting their position slightly out of the sonar range and then back in range again) would register the event and try to throw the event back at the kiosk/code. This makes for a lot of coding in javascript to make sure the cursor is in the right spot and also what button did the person push on the touch screen which basically is caught as a mouse click event. Using the mouse HID approach could turn out to be much more difficult, though more easily coded on the PIC, to try and figure out where the mouse click event is coming from to ignore it. If I have a pseudo keyboard displayed on the screen the mouse click event would trigger regardless of coming from the PIC or touching the screen and really no way that I know of to separate the two. Using HID is a pain for sure but since IE and Chrome have different approaches on how I would have to access to a normal USB device which would require an active-x control (IE only) that's getting to be more pain. Off topic a little is that I am dealing with customers that are supposed to be IT professionals but most of the time it's more like I dio T professionals I am dealing with. I tell them you have to enable active-x on the browser the likely response I will get is how, what's that, no, what's a browser, etc.

    I appreciate the idea I'm actually going to look at that HID mouse and the javascript behind capturing mouse click events.

    Thanks
    David

  16. #176
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    Using HID is a pain
    I'm not sure how you came to that conclusion. IMHO PicBasic implementation of USB is not optimal but seems (I've only ever used it to run the samples, I normal live on the dark side) to be workable. I suspect your real issue is with Descriptors and there PicBasic really isn't very friendly at all. Does you kiosk have a real mouse and keyboard available to joe public?
    George

  17. #177
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, No the kiosk does not have a mouse or keyboard attached. All keyboard entry that an individual will do is with an on screen keyboard that I generate. Don't get me wrong the pic is working fine and the descriptors are not all that bad.

    Imagine I am typing this comment now and my sonar sensor goes off then right in the middle of my text entry on my keyboard "wakeup" shows up inline with my typing. If I could tell the pic to go to sleep (stop sensing) while I am in this memo box until I click the "post quickly reply" all my filtering out events worrying goes away in my code (javascript on my web page). Image my mouse is at the same time hovering over the "post quick reply" button and I have my pic set as a HID mouse and the sonar sensor goes off and sends a mouse click event then my reply here gets posted before I have a chance to finish my comment. None of which is really a problem, coding on the pic or the javascript to interact with the person. Things would be much simpler however if in my javascript I could talk to the pic.
    Thanks
    David
    Last edited by DavyJones; - 22nd September 2019 at 11:45.

  18. #178
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    It all sound very complicated. But I get from your last post that the "person detector" going of at random intervals is an issue. Don't forget that the keyboards data flow is bi-directional in that you have 3 bits of data that you can send (status lights - note that these are not slaved to the buttons that activate them, the button press is sent and the necessary bit is sent to turn the relevant status light on). So you could disable the "people detector" at will. Don't know if that helps or if I've got it arse backwards.
    George

  19. #179
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    George, Thanks.... It's more coding to keep track of all the events that's the real pain. Unfortunately programming in javascript or any client side code (In the browser) does not allow you to send anything back to the HID. javascript/html/web programming does not allow you to poke anything back as if a true keyboard button was pressed so there is no way in the code to say "press caplocks" or any key for that matter. It's a big security risk. Imagine visiting a web site and unbeknownst to you the web site sends to the keyboard keystrokes that would amount to "get all the password files on this system" or press ctrl/alt/del or whatever. My on screen keyboard is just a bunch of web buttons and I have coded in the onclick event to figure out what text box the cursor is in and put that character into it. The button onclick does not register as a true keyboard keypress event.

  20. #180
    Join Date
    May 2013
    Location
    australia
    Posts
    1,743

    Default Re: PIC USB HID breakout board

    Unfortunately programming in javascript or any client side code (In the browser) does not allow you to send anything back to the HID. javascript/html/web programming does not allow you to poke anything back
    i see no code in my browser that turns on the caps lock led . surely the os handles that functionality at much lower level.

    if you send a caps lock or scroll lock key code does something come back from the os keyboard i/f ?

    if so the pic can remain mute till sensor hits stop for a suitable time after that state is detected , then reset the lock status until the next hit

    what do you need to wake the kiosk can a "non printing" key wake it up ie shift etc ?
    This is more entertaining than Free to Air TV

  21. #181
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    Java (of which I know nothing other than imho it both blow and sucks - no flames please) script must allow key depressions, so if your app press the shift key, that status bit would be sent to the Pic device. Maybe I'm missing something, I probably am, not the sharpest knife in the box.
    George

  22. #182
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    178

    Default Re: PIC USB HID breakout board

    javascript (Not Java different beast which is a compiled language one I don't like either) and HTML/HTML5 are the languages of the browser and both interpreted languages. Neither javascript or HTML/HTML5 have access to the low level API one would need to do things like set the caps/scroll/num lock on/off or simulate pressing any of those keys or any other key for that matter it's a security breach for any web browser that would allow such access.

    Pressing caps/num/scroll lock on the keyboard physically connected to the computer while my HT42B584 breakout board is connected, which has 3 corresponding LED's for each of those, does turn the LED on/off so it is bidirectional with regards to that however there is with 100% certainty that javascript/HTML/HTML5 on their own have no command or API access to set cap/scroll/num lock keys on. They have no access to the OS low level API you would need.

    There Is no actual way either, in javascript, to tell if the caps lock is on or off. You can not poll it, the letters you type on your keyboard are upshifted or not. If you've every visited a web page and start typing and you see a little message under the text box you are entering text into that says "caps lock is on" this can only be done in javascript in a round about way. You have to capture the keydown event and the shift register. You then have to have a check if the character they pressed was a 65 and the shift register (shift key was held simultaneously) was not true well then you know the caps lock key is on otherwise the keycode would be 97 this is why you will never see the message "caps lock is on" until you type the very first character into your text box.

  23. #183
    Join Date
    Apr 2013
    Posts
    305

    Default Re: PIC USB HID breakout board

    It all sounds horrible.

    If I may take an enormous liberty and suggest that you take a step back and restate the problem. Describe the problem in simple terms. Don't think about solutions just consider the problem. Describe your brief, separating mandatory and desirable features. Just a suggestion, shouldn't take more a few hours. Did your client give you a written brief (not suggesting you should post it, just curious)?
    George

  24. #184
    Join Date
    May 2013
    Location
    australia
    Posts
    1,743

    Default Re: PIC USB HID breakout board

    i agree with george.
    i assumed the task is to wake a "terminal" with an unintrusive keystroke when someone approaches
    and to let the terminal timeout due to inactivity without further intrusion, rearming after a
    timeout period and possibly re-triggering if bodies still detected {just in case you might say}.
    or not re-triggering at all till no bodies are detected for a guard period
    i don't see where comms with the browser matters at all.
    This is more entertaining than Free to Air TV

Similar Threads

  1. USB hid maker help please.
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2013, 14:49
  2. HID USB on 18F87J50
    By pedja089 in forum USB
    Replies: 56
    Last Post: - 25th August 2011, 09:24
  3. USB HID and RealBasic
    By PJALM in forum USB
    Replies: 5
    Last Post: - 6th July 2011, 07:49
  4. USB HID Problem
    By Gitchie in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th January 2011, 16:15
  5. Usb hid
    By yatyas72 in forum USB
    Replies: 5
    Last Post: - 3rd December 2010, 16:45

Members who have read this thread : 33

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts