can anyone give me an example as to how to connect and control something from a serial port.....something really simple like a light bulb.....
hey maybe this.....
I have a teddy bear which runs on batteries
when you squeeze his foot he snores....
I would love to connect and control him by the pc
any ideas...please

no subject
KenHerman
ok
so if I understand you correctly, all I need to do is get a paralell cable and cut the plug off one end and connect the wires to the teddybear
battery wires positive and negative..= pin2 and ground...=...supplies the power......(.then I need to connect a wire to the switch which I can enable/disable on the keyboard)
does that sound correct
edit...sorrry I mean a rs-232 cable
alpefusk
ok carsten
this sounds really interesting.....I will have to read up on what you said and buy some stuff before I attempt anything...
the teddy bear only uses 2x 1.5v batteries....it has a touch sensor that makes him snore and move his head.....
I dont have a voltage meter at the moment but thats not a problem.....does that help any in knowing what else I will need
apart from the meter
cheers
Grabner
If you don't have a voltmeter you don't need to buy one. In that case, you just need a little more surgery on the teddy bear. You need to find out how the sensor is connected by following the conductors from the battery. It is probably just a simple switch from one side of the battery to the electronics and the head movement motor, but it can be more complicated.
You are lucky that the voltage on the teddy bear is 3V. This is enough for a direct connection, so if you don't need any outputs (lamps etc.) you can just connect some conductors (maybe through a short circuit protection resistor). But again, be careful not to burn off the serial port. Don't do anything if you are not sure. Better ask one time more than one time too less!
tolily
hi renee and thank you but at the moment 2 bits in and 2 out are about 2 bits more than enough...
I said I was stupid, so carsten is trying to enlighten me......(not an easy task).....I am baffled already.....
once I have done something easy.....then .......who knows what I will produce.....128 bits.....peanuts.....lol
johnvarney
sorry for the misunderstanding.....lets recap..
yes I said serial port.....but it dosent really matter.. whatever is easiest...and all I initially wanted was to control the movement of the teddy bear.....
so just to connect to the switch is fine ...but if it is only 3 volts....can I not power it from pc as well.....or does that complicate things..
I want the most simple to start with......just to get the hang of things
thanks
Rob Wilson
Not a parallel cable - a serial port cable. In your original question you writes the serial port, and my answers is based on that. Do you mean the parallel port instead
No it does not sound correct! If you want to start the head motor from the PC, you need an output. The serial port cannot drive the motor directly. You need to connect a switching transistor in parallel with the sensor in the teddy bear. I thought that you wanted to read the switch. However, output is not difficult. A single resistor, a transistor and a protection diode may do the job.
Tell me what you want to control from the PC, and what you want to read on the PC, and try to find out how the switch is connected.
naiad
The software is very simple.
First you must make a COM port:
Note that WithEvents is specified so that you are able to react when the modem control signals change.
Then you can just set and reset the DTR and RTS outputs from the PC by means of:
To read the input you need to react on the PinChanged event like this:
Private Sub ModemLamps(ByVal sender As Object, ByVal e As SerialPinChangedEventArgs) Handles COMPort.PinChanged
If COMPort.DsrHolding Then
DSRLamp.BackColor = Color.LightGreen
Else
DSRLamp.BackColor = Color.Gray
End If
If COMPort.CtsHolding Then
CTSLamp.BackColor = Color.LightGreen
Else
CTSLamp.BackColor = Color.Gray
End If
End Sub
Where the modem lamps in this case are just Button controls.
If you want more information about software for the serial port, you can read the description of the serial port program in the knowledgebase on our homepage. This describes everything in minor details in a language which even beginners has a chance of understanding.
The URL is:
http://www.innovatic.dk/knowledg/SerialCOM/SerialCOM.htm
Then comes the more difficult part - the hardware.
There are hundreds of links showing the RS-232 pinout. Here is just one of them:
http://www.airborn.com.au/rs232.html
but if you don't understand this just search Google for RS232 or ask again.
Be very careful not to short circuit the pins. They are usually not short circuit proff!!!
To interface to the teddy bear, I need a little more information of what you want to do, the battery voltage etc., and I need to know if you have any access to measurement instruments like a voltage meter etc.
nils_gate
From a software point of view the serial port is the easiest solution as there is no support for the parallel port in .NET. Besides, there is not much future in the parallel port. Most modern PC's do not have a parallel port.
You cannot power anything, which requires more than a few milliamps, from the serial port, but since you have a power supply in the teddy bear this is not a problem.
Follow the leads to the battery and find out which part of the switch is connected to the battery and which part to the rest of the circuit. Also find out if the part, which is connected to the battery, is positive or negative. Try to find out as much as you can about the inner connections of the teddy bear.
JonnyAJAX
thanks carsten
I think I,ve got the jist of what you said....I willl work on that and see how I get on
thank you very much
cheyenne
Tiziano27
First of all - everything carsten has said is true. I think he presented things in a more limited fashion than they need to have been presented. If you only have two bits of input and two of output, they can be expanded to 64 or 128 if you wish.
All I'm sugesting is that you don't limit yourself based on the bare implications of what he said.
crogenicdude
ok thanks
I am just about to amputate his leg......she,ll kill me.....lol
now that I have got some code I will experiment.......thanks again
I may be back to you tomorrow
cheyenne
Mio
thanks for the reply carsten....
the second solution sounds the simplest....although I know absolutely nothing about this.....
if you can give me some more info and maybe some code I would be really grateful......pretend I am really stupid....
well maybe you dont have to pretend in this instance.......thank you
cheyenne
Raoul_BennetH
There are two ways:
1) You can make a communication link by means af a UART and a microprocessor in the teddy bear. Then you can do anything you like, but it requires some hardware e.g. in the form of a microprocessor evaluation bord and of course some microprocessor programming - usually in assembler or C
2) You can utilize the modem control signals DTR and RTS from the PC and DSR and CTS from the teddy bear. This only gives you 2 input signals and 2 output signals, but it is really simple. The only disadvantage is that you cannot draw very much current from these channels, but since there is a battery in your teddy bear, a single resistor and a transistor per output channel is all you need to buffer the output signals. The input signals to the PC from the teddy bear can be connected directly if the battery voltage is 3V or above.
In both cases you need access to a soldering iron - especially to be able to connect the serial port cable to the plug.
Which of the above solutions do you want
zion99
ReneeC
You cannot expand two bits to 64 or 128 without some hardware in the teddy bear and the hardware is the problem - not the software.
I am right now working on the controller chip for a new event driven fieldbus system, which will enable you to connect over 1000 units to one bus and address thousands of measurement values - even in safety systems where life may be in danger (see http://www.innovatic.dk/fieldbus.htm ). I know the advanced solutions, but for someone, which does not even have a voltmeter, we better keep it simple.