Transmit and Receive Data Wirelessly from a keyboard to a microcontroller

micro9000

New Member
I would like to have a wireless signal sent from a USB keyboard to the microcontroller(PIC18F4685), where the micocontroller will interpret that data and use if statements to perform certain tasks. For instance, if I type "A" on the keyboard it will send a signal wirelessly to the microcontoller and it will turn an LED on or off. Here is my idea (which I of course need your input on the matter):

**broken link removed**

**broken link removed**

As for PWM input I searched the forum here and looked over the datasheet. The datasheet doesn't provide sample code in C programming language (at least I didn't see any examples). I did however find this link, which was posted in the forum:

Pulse Width Modulation or PWM Tutorial using PIC 16F877, Proteus and Mikroc PART-2 |Linux and Microcontroller Tips

This is sort of confusing to me, and I would kindly ask if anyone could provde me with a template program pertaining to what I want to accomplish (Receive bits in RC2 and turn an LED on out of RA1). Not to mention the above link is using a different microcontroller, so the code may not be applicable.

So, my main questions are:

1.) What oscillating circuit do I need (crystal oscillator perhaps)?
2.) How do I handle the D- and D+ going in to the oscillating circuit/antenna?
3.) What pins should I be using for PWM (if it isn't just RC2)?
4.) How do I set up the code for PWM using C programming language (a template would be much appreciated)?

Any other comments or suggestions would be much appreciated. I really could use your help on this matter. Thanks in advance.

EDIT: Here is the PIC 18F4685 pin diagram
**broken link removed**

RC2 is CPP1, which according to the datasheet can be used as an input for PWM. So, I think I am correct, but I still don't quite understand how to set up that pin as an input for PWM and how to handle the wireless signals.
 
Last edited:
The keyboard is a USB slave. If you want to read the data from it, you will need a USB host. That is not simple to do. You can search this forum about previous discussions on USB hosts.
 
If you made that a PS2 keyboard, there would have to be loads of projects out there to look at. Add a Pic to decode the keyboard then transmit/receive with a pair of XBee modules and you're done.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…