Sign in to follow this  
macmoy

How to communicate with a hardware? NOOB here.

Recommended Posts

Hi guys! I want to make a device that will send 1 or 0 OR true or false to the computer. Here's the scenario. I want to make that device,then when 1 or true is sent to my program in the computer(windowsXP), a sound will be playing. so the questions are: (from a total noob) How will I make that device? How to connect it to the computer? (usb? or something else?) How will my program communicate with that device?(i think, my program will only be listening inputs from the device. The device must have 8 toggles(i mean, 8 peices of 1 or 0) Please help me with this, I badly need it. Thanks a lot. by the way, I know how to program in vb6,c++(im a game developer). I hope I can make this device. thanks a lot in advance.

Share this post


Link to post
Share on other sites
How will I make that device?

Circuit board, soldering gun, resisters, capacitors etc.

How to connect it to the computer? (usb? or something else?)

Depends on what you want and what you know how to do. USB, parallel port, serial port. There are options.

How will my program communicate with that device?

Assuming that you're running Windows, you'll need to write a device driver first so that the operating system can communicate with the device. Here's a link: Communication between GUI Application and Device Driver.

There's a learning curve to this, so don't expect to accomplish the task in one day (or maybe even one week).

Share this post


Link to post
Share on other sites
You will probably want to go with a serial port, USB is fairly complicated and wouldn't be worth implementing for such a simple task. Having that been said it still is not going to be easy to even implement a serial port.

Here is some information you might find helpful.

Information about how serial ports work

Using COMM ports in visual basic

Suggested hardware to communicate with computer

There are other options for creating the hardware to communicate with the computer but I have found basic stamp to be fairly easy. The downside is that it may be pricey for your budget and be an overkill when it comes to functionality it offers compared to the functionality you need. If you plan on making further projects with it then it shouldn't be a problem.

There is also going to be a small learning curve for using basic stamp, if you need some help with it send me a private message and maybe I could explain things for you.

Share this post


Link to post
Share on other sites

I really dont have ideas or knowledge how to start.
this is the problem.
I want to make a digital drumset.
so i only want if a button for the snare drum is pressed then the sound of snare will play in the pc.

I can do the program that plays the snare,bass,cymbals,etc.

BUT I dont know how to receive that information from my device. A device that is not yet made.how can I make a device like that?(simple buttons).
why do I need resistors,capacitors,etc. for what?
Im very sorry,your my only hope to make this posible to make. I have here a breadboard(white&small). so will i use this? whats the use of the green board?(i dont know if it is called "green board",I think know what am I referring to.)

Im very SORRY Sir.
thanks for any help.

Share this post


Link to post
Share on other sites
Rip apart a PC gamepad and re-use the controller board (should be very easy if you have any understanding of digital electronics). If you don't completely destroy it, it'll be accessible like a gamepad to the software, but on the physical side you can hook anything up to the button wires that closes their circuits.

Share this post


Link to post
Share on other sites
thanks for yout reply.
too bad i dont have any game pad.

and i really want to learn it from the bottom.

please, if anyone knows how to do basic stuffs like pushing a button and sending 1 / true to the computer.

please help me.

Share this post


Link to post
Share on other sites
You could use a printer port... if your computer has one. That's the only interface I know of where you can just connect wires directly to the PC (without any kind of integrated circuits) and actually have it work. I did this with a Nintendo Powerglove back in high school.

Sadly, I don't know how hard/easy it is to communicate with one of those in modern operating systems. Last time I messed with printer ports was with DOS.

It really would be easier to just buy a cheap PC gamepad and hack your drums to it. That's basically what the Rock Band controllers are (well, they are modified controllers for their respective consoles, anyway).

If you really want to try just hooking up raw wires to your PC, go ahead, but don't be surprised if you fry your computer.

(Edit) These also look like a good way to do USB hardware projects...

Share this post


Link to post
Share on other sites
thanks again for reply.
are you reffering to the serial port? the 25pins? or 9pins?
how can i receive data from it? and how will i make the device?
Im really confused. i dont know how to start..

:(

can anyone please tell me the stepbystep?

for example,you need this and that,insert this to that,etc.

please... thanks..

Share this post


Link to post
Share on other sites
Oh come on, show some effort of your own.

These forums are here to exchange helpful hints, tricks, and ideas to others who already have enough knowledge (or capability to do their own research) to put that information to use. We are not "Ask Jeeves" of computers... That's what automated search engines are for.

We've given you plenty of leads, however it's up to you to finish what you've started.

(Edit) since English might not be your primary language, you might not have any idea what search words to use. Here are some keywords that might help you:

pinout diagram
LPT port diagram
digital circuit
breadboard
printed cirtuit board
supply voltage
signal voltage
reference voltage
short circuit
circuit ground
rising edge
falling edge
baud rate

[Edited by - Nypyren on December 21, 2008 1:15:24 AM]

Share this post


Link to post
Share on other sites
yes, english isn't my primary language.
im sorry, i really dont know anything about this. i also dont know where to start.
by the way, i have taken "logc design" class when i was first year college. we use breadboard.

im only 18yrsold right now, please tell me how to start, from there,il be searching other things that will make the device. but for now,I know NOTHING.(except what is a breadboard and playing switches on it, but, how will i make the serialport that will plug into the pc? where will i connect the other end on the breadboard? is breadboard enough to make this device? i only know the microchips that are and,or,not(i think its 74lsxx or something.if i remembered it correctly.)

please help.

I apologize for being a naughty student :D

Share this post


Link to post
Share on other sites
let me clear things out.

first, i dont know what type of socket will i use.
I think its enough to use 25pins.(the one on the back of a PC)

okay, lets assume that Im going to use that.I will buy that thing and then what?
I have a breadboard here,some wires and switches.

now the problem is,how will i make that device?are there other thing which i need aside from these stuffs?(25pin male socket,breadboard,wires,switches)

if i miss something, what are those?

if not, how will i start making the device?
where will i connect the 25pinMale on the breadboard?
where will i put the switches?

thats it for now. after i made this device, thats the time ill search on how to communicate with it. but as of now,i dont know how to make the device itself,so i cant learn communicating with it.

I hope you understood my problem.

kindly please please please,help me :(

Share this post


Link to post
Share on other sites
You need to understand the basics of digital (and to a lesser extent, analog) electronics in order to implement a device like you describe. This requires a lot of reading and tinkering ;)

To start building any electronic device, you need (at the very least) a soldering iron and some soldering tin, color-coded wire, and the components you're going to use. In addition, it is good to have several prototype breadboards so that you can arrange and test the components together before etching the final board to a fixed layout.

As for the communication electronics, there exists a wide selection of pre-programmed IC (integrated circuit) packages that handle serial as well as parallel communications given your input/output signals. Most PIC controllers (ICs that you can program yourself) will also contain integrated serial port hardware. For programming PICs you need a device called "PIC burner" that takes your chip-specific code (that you write using C/assembly/something) and imprints that to the chip so that it will run said code.

An USB port is essentially also a serial port, but it has a specialized protocol (for device discovery and multiplexing) that makes implementing an USB device somewhat more complex than a legacy serial device.

Unlike serial port which sends bits one by one in a queue, a parallel port has dedicated lines for each bit so it can transfer all of them in one clock cycle (hence "parallel"). Otherwise, the complexity of the electronics is somewhat similar. I personally recommend serial communications because I find it easier to handle on the software side.

In your case, the drum pads would trigger the input bits of the controller chip; in response to this, the chip would pour the stream of bits which you would then read with your software, be it a driver or a user-mode serial client. After that, it is just the matter of playing the right sounds based on the incoming data.

Share this post


Link to post
Share on other sites
ahh i see.

but is it imposible not to use ICs?

Can't i just use breadboard,wires,switches(not yet drum pad coz im just experimenting before spending money on it),rs232 25pins.???

if its posible, what will be the look of the wirings?

thanks

Share this post


Link to post
Share on other sites
The only purpose of wires is to connect components over distances other than zero, nothing more. It helps if the wires are colored differently from each other, so you can distinguish each individual wire.

If you don't want to use ICs, you need a somewhat large amount of transistors in order to implement the logic required, and your task will become a lot more difficult. Think of ICs as "black boxes" that take simple input, process it and send out the processed stuff, all without you knowing the minute details behind the actual processing logic inside. Of course, in PICs, you get to define the processing logic too.

Share this post


Link to post
Share on other sites
ahh. but do i still need it?
even the device will only send 1 if the switch is turned on and 0 if the switch is off?

thats very simple logic right?
i think its simple to make a device that does that? am i wrong?

Share this post


Link to post
Share on other sites


can you see the image above?

that's my problem.

where will i connect those wires??
and what wires will i connect to the switch.
thats it.
if i got that, the the next part is the programming.
ill just listen if some switch says "1" then i'l play a sound.

so how?

Share this post


Link to post
Share on other sites
Actually, if 8 bits is enough, you could drive the data bits of a parallel port directly with the switches. Then, the difficulty would be on the software side.

The downside of this approach is that if you ever need to send more data besides these 8 bits (and you will eventually want to), you don't have any data channels left and by that time, you would probably need a separate logic controller anyway.

Share this post


Link to post
Share on other sites
Quote:
Original post by macmoy


can you see the image above?

that's my problem.

where will i connect those wires??
and what wires will i connect to the switch.
thats it.
if i got that, the the next part is the programming.
ill just listen if some switch says "1" then i'l play a sound.

so how?


You need to make the blue connection with a serial controller (to be exact, one input data pin of the controller per switch), if you are going to use a serial port and/or multiple switches. Generally speaking, it is not so simple as to just solder a pin of the D-sub socket to the switch and hope for the best. This is why the controller chip is necessary.

Share this post


Link to post
Share on other sites
serial controller? you mean, ICs?
what are parallel? will it also use rs232? or different socket?

huhuhuhu. Why cant you just connect the wire from the rs232 to the switch? i have nothing else to do. just turn on the switch and send a "1" and turn it off and send a "2".
that's all.then after i made it for atleast 3 switches, il make it 8 switches..

huhuhu, how will i make it?

Share this post


Link to post
Share on other sites
The serial port works at certain frequency (clock rate). For each clock cycle, the receiving hardware reads one bit by comparing the voltage of the incoming data pin with a reference value (whether it is above or below reference determines whether it is 1 or 0). When it has received certain amount of bits (usually 8) and/or a stop bit, it gives those bits to the host device (which can then read them from the port) and repeats the process again.

The above is an extremely simple description of how incoming serial data works (there are a lot of additional quirks) but it should help you see why things do not work if you just solder one leg of your switch to the RxD pin of the RS232 connector.

Share this post


Link to post
Share on other sites
so if i solder one output to the switch and 1 input. then if i turn the switch on, there would be an electric current? which in other words, the device is sending "1" to the PC?? is that right?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this