Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: sidz on December 26, 2009, 12:57:05 PM

Title: Need help Serial to Parallel conversion
Post by: sidz on December 26, 2009, 12:57:05 PM
Hi, my laptop does not have any Serial/Parallel ports only USB. i want to create my project (e.g. a Computer controlled RC car) to start with i need to be able to control external relays etc from my laptop.
I have a USB to Serial converter now to control external relays i need to convert these serial signal to parallel.

Please suggest how to proceed.

-cheers
sid
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on December 26, 2009, 03:00:39 PM
One way is to connect the serial adapter to a micro-controller that contains a UART. A short piece of code would take the serial data and set/reset IO pins.
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on December 27, 2009, 03:05:33 AM
Thanks..
I was thinking to do some thing like this:
Use a usb to serial converter to send signals to. Then convert these using a MAX232 then pass this output to an Atmega168 the o/p of this micro is parallel out put.

Please suggest am i correct. if not then ho can i do this.
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on December 27, 2009, 10:18:23 AM
Yep, that will work and will give versatility in your design.
Title: Re: Need help Serial to Parallel conversion
Post by: galannthegreat on December 27, 2009, 03:11:46 PM
You could use a shift register here. The 74HC595 would work as the chip in this case.

Check out the datasheet: http://www.fairchildsemi.com/ds/MM/MM74HC595.pdf (http://www.fairchildsemi.com/ds/MM/MM74HC595.pdf)
Here is the part on Digikey: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MM74HC595N-ND (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MM74HC595N-ND)
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on December 28, 2009, 10:50:54 AM
thanks all,

i am really new to this world; can you please throw some more light about 74HC595.

1.How to use it exactly?
2.Can it directly interfaced to a Serial Port or does it needs a uC?
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on December 28, 2009, 11:51:55 AM
I would not recommend the 74HC595. Asynchronous data from RS232 does not have a clock which the 74HC595 requires. That means an additional clock circuit and also a Start bit detection circuit. I could design these but wouldn't since it is much cheaper and easier to use a micro-controller like a PIC or Atmega with a built in UART module and independent IO ports.
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on December 28, 2009, 12:17:38 PM
Thanks Waltr, so i will start with Atmega then.

but to start with i need some more help, as i dont have any exposure can you please suggest from where to start with. where to find basic tutorial on atmega where i can understand what it does, what are pins specification and related terminologies i tried searching but cant find any basic, all are very high level for me :( .

As i understand uC's are blank, how to program Atmega168 for serial2parallel conversion, are there already libraries defines for this or do i need to write some and burn it in this chip.

-cheers
sid


Title: Re: Need help Serial to Parallel conversion
Post by: waltr on December 28, 2009, 01:11:23 PM
SoR has a number of good tutorials. Start here:
http://www.societyofrobots.com/microcontroller_tutorial.shtml (http://www.societyofrobots.com/microcontroller_tutorial.shtml)

Since you have never worked with a micro-controller there will be a bit of a learning curve.
A number of people here are using the Atmega so you will also find lots of info in these forum threads, do some more searching.

Yes, you will need to write a program and 'burn' it to the chip. There are libraries to handle the UART (a serial to parallel hardware module) and SoR tutorials explaining how to use it. The libraries just make the programming easier by providing a block of code to do a higher level task. you still need to write to code that use the library functions.

There are several development boards that use the Atmega chip. The AVR and the Axon are popular and will meet your requirements. Both are talked about in the SoR tutorials.
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on December 29, 2009, 02:51:49 AM
Here is a board almost ready to go.
https://www.sparkfun.com/commerce/product_info.php?products_id=762 (https://www.sparkfun.com/commerce/product_info.php?products_id=762)
Title: Re: Need help Serial to Parallel conversion
Post by: GearMotion on December 29, 2009, 09:10:56 AM
A USB relay board, like this one: http://www.usbmicro.com/documents/BA776D9CD765B2F7FA68ABA88C1F247FC3A76F25.html (http://www.usbmicro.com/documents/BA776D9CD765B2F7FA68ABA88C1F247FC3A76F25.html)

(http://www.usbmicro.com/images/9794014B96B91330DD628DBB09439CAACD733869.jpg)

http://www.circuitgizmos.com/products/cgu451/cgu451.shtml (http://www.circuitgizmos.com/products/cgu451/cgu451.shtml)
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on December 30, 2009, 02:12:32 PM
Thanks, but unfortunately i wont get these circuits in my country :(.

this does gave me idea that external device can be directly controlled from USB rather than my original idea of multiple conversions USB-> Serial -> Parallel, its clumsy and high risk of data loss.

when i dug a bit more found v-usb whose components are also available in my country see below:
http://www.obdev.at/products/vusb/powerswitch.html (http://www.obdev.at/products/vusb/powerswitch.html)


this looks pretty simple so thinking of starting with this, have tons of doubts though.......  please suggest as a starter should i start with this.

thanks again :)

cheers,
-sid
Title: Re: Need help Serial to Parallel conversion
Post by: GearMotion on December 30, 2009, 03:26:21 PM
Thanks, but unfortunately i wont get these circuits in my country :(.

What country?
Title: Re: Need help Serial to Parallel conversion
Post by: SmAsH on December 30, 2009, 05:18:35 PM
I'm gonna take a stab and say austria?
Title: Re: Need help Serial to Parallel conversion
Post by: GearMotion on December 30, 2009, 05:37:13 PM
I'm gonna take a stab and say austria?

Then is sidz's reluctance the act of ordering off of the internet?
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 01, 2010, 10:51:20 AM
India..... i thought of ordering through online shops but shipping charges from US/UK are too much..
Title: Re: Need help Serial to Parallel conversion
Post by: SmAsH on January 01, 2010, 07:59:30 PM
http://www.societyofrobots.com/international.shtml#india (http://www.societyofrobots.com/international.shtml#india) ?
Title: Re: Need help Serial to Parallel conversion
Post by: dunk on January 02, 2010, 02:36:35 AM
hi Sid,
V-USB uses a microcontroller to emulate a USB device in firmware. it's implementation is more complicated than most beginners projects.
since you have no microcontroller experience you would have a lot to learn before you got it working.

connecting a microcontroller to a USB to Serial dongle would be far easier.
as already mentioned, some of the tutorials on this site will guide you through beginning with microcontrollers, (look for the "$50 robot" project.)


if you want I/O over USB but want to avoid using a microcontroller altogether have a look at this device:
http://www.ftdichip.com/Products/FT245R.htm (http://www.ftdichip.com/Products/FT245R.htm)


dunk.
Title: Re: Need help Serial to Parallel conversion
Post by: HyperNerd on January 02, 2010, 05:44:22 AM
If you used a PIC or Arduino I could help out with the code ;)

I think the best method here would be to use a microcontroller ie. a PIC or AT Mega, then write a simple program so it acts like a shift register, but without the need for the synchronous clock line.

Here is an idea of how to do this:

The uC receives 8 bits of serial data through UART from PC.
Each bit of the 8 bits corresponds to an output pin.
For example the 8 bits, '00000101', would switch ON outputs 0 and 2, and switch 1,3,4,5,6 and 7 off.
The microcontroller only needs to update the pins when it receives new data, so there is no need for it to remember what the last piece of data received was.

 -HyperNerd
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 05, 2010, 10:34:59 AM
Thanks All...
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 05, 2010, 10:47:57 AM
Thanks HyperNerd, dunk

first of all i really appreciate all of your's feedback to help me.

my original idea was to use a USB to Serial converter and write data to the serial port using communication API of java then using some hardware converrt the Serial signal to Parallel, but unfortunately as i was very new and did't had any experience so thought using an easier circuit like v-usb, where there is no coding required will be easier but my luck can get all the components in my country.

Finally had to drop the idea of using V-USB now i am back to the original  idea suggest by waltr and you all of using mc (Atmega/PIC).

As suggest and as i read using an Atmega will be lot more easier, but i am open to both, i am still looking for a proper hardware as well as software using either an PIC/Atmega to achieve this.

thanks again to all.
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on January 05, 2010, 12:40:41 PM
Well you will learn doing it with a Atmega/PIC. Then you can improve the design.

Good luck and keep us posted with your progress.
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 23, 2010, 06:03:37 AM
hey, i finally decided to start using a PIC, designed the circuit as well as software to be burnt and bought all the components...!!!

well was thinking to start with but before starting was going through the data sheets of MAX232 and PIC and here got a set back :-[
as in max232 can recognize only voltage level between -3 to -15 and +3 to  +15..... as i am using a USB2serial converter when i checked the voltage levels at the Tx pin ... it hardly shows 0.3 volt when its is transmitting....

Can anyone suggest a way to overcome this what i think, i need to place some sort of voltage amplifier between my USB2Serial converter output and MAX232 in..... but dosent have any clue what to do...

cheers,
 sid
Title: Re: Need help Serial to Parallel conversion
Post by: Pratheek on January 23, 2010, 07:31:00 AM
I think you do not need a MAX 232 IC between the USB to serial converter you are using and your microcontroller. I guess the USB to serial converter itself gives you +0 and +5 V outputs.

Could you post a picture of the converter you are using.
Title: Re: Need help Serial to Parallel conversion
Post by: waltr on January 23, 2010, 09:47:59 AM
There are two sides on the MAX232, the TTL side and the RS232 side. The RS232 side (a comm port on a PC) is +15 to -15 volt. The TTL side is 0 to 5V. The TTL side connects to the PIC (the UART pins) the RS232 side goes to the 9-pin D connector on you PC. The MAX232 inverts and level shifts the PIC TTL signals to RS232 level signals in one direction and the reverse in the other direction.
There is a ton of info on using a MAX232 and a PIC. Do a little googling to find examples (SoR even has a tutorial on using the MAX232).
Title: Re: Need help Serial to Parallel conversion
Post by: Soeren on January 23, 2010, 06:37:51 PM
Hi,

[...] when i checked the voltage levels at the Tx pin ... it hardly shows 0.3 volt when its is transmitting....
How did you check that?

If you use a voltmeter while transmitting, you would see a somewhat integrated signal and since it shifts between positive and negative signals, they'll sum up to something relatively close to 0V (assuming everything works).

What do you measure on TX and RX (relative to ground/0V) when NOT transmitting?
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 24, 2010, 04:14:58 AM
Hey Soeren thanks i understand what you try to say. now to answers the question

How did you check that?
What do you measure on TX and RX (relative to ground/0V) when NOT transmitting?

I used a voltage meter to measure the voltage levels.
While not transmitting on Tx & Rx it shows something approx 0.02V

cheers,
Title: Re: Need help Serial to Parallel conversion
Post by: scadabg on January 24, 2010, 06:25:08 AM
Hi, my laptop does not have any Serial/Parallel ports only USB. i want to create my project (e.g. a Computer controlled RC car) to start with i need to be able to control external relays etc from my laptop.
I have a USB to Serial converter now to control external relays i need to convert these serial signal to parallel.

Please suggest how to proceed.

-cheers
sid
I would suggest you using this board :

-It has 6 relays
-bluetooth uart adapter
-power supply
You then can use your pc bluetooth to connect to this board and control the relays (no cabling needed)

(http://www.microcontroller-bg.com/components/com_virtuemart/shop_image/product/GSM______________4b12c9ff551df.jpg)
Title: Re: Need help Serial to Parallel conversion
Post by: scadabg on January 24, 2010, 06:28:16 AM
Hi, my laptop does not have any Serial/Parallel ports only USB. i want to create my project (e.g. a Computer controlled RC car) to start with i need to be able to control external relays etc from my laptop.
I have a USB to Serial converter now to control external relays i need to convert these serial signal to parallel.

Please suggest how to proceed.

-cheers
sid
I would suggest you using this board :

-It has 6 relays
-bluetooth uart adapter
-power supply
You then can use your pc bluetooth to connect to this board and control the relays (no cabling needed)

(http://www.microcontroller-bg.com/components/com_virtuemart/shop_image/product/GSM______________4b12c9ff551df.jpg)


And using this board you can also control the relays from your mobile phone see below

(http://microcontroller-bg.com/images/stories/igallery/projects-1/large/P1011024.JPG)
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 24, 2010, 10:08:02 AM
Thanks Scadabg but from where do i get it.

cheers
Title: Re: Need help Serial to Parallel conversion
Post by: scadabg on January 24, 2010, 01:13:51 PM
Thanks Scadabg but from where do i get it.

cheers


You can get a kit or assembled version from microcontroller-bg.com (http://microcontroller-bg.com) or assembled version
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on January 30, 2010, 07:56:21 PM
@ Soeren, I have posted the details earlier of the voltage levels that i get when the transmitter is ideal,
what do you suggest? does the data seems ok... should i proceed.
Title: Re: Need help Serial to Parallel conversion
Post by: sidz on February 01, 2010, 12:30:55 PM
hey thanks Pratheek,
I think you do not need a MAX 232 IC between the USB to serial converter you are using and your microcontroller. I guess the USB to serial converter itself gives you +0 and +5 V outputs.

Could you post a picture of the converter you are using.

As i said earlier the output of the USB2Serial converter is hardly 0.3 volts when checked with a digital multimeter.
Secondly I am using a ready made USB2Serial converter so does a picture help? if yes please let me know will post the picture and the details.
Title: Re: Need help Serial to Parallel conversion
Post by: Soeren on February 01, 2010, 04:21:27 PM
Hi,

@ Soeren, I have posted the details earlier of the voltage levels that i get when the transmitter is ideal,
what do you suggest? does the data seems ok... should i proceed.
You can't see dynamic signals above 5..10Hz on a DVM, it's like trying to measure your pulse with a thermometer (well, sort of at least).

Either find someone who can help you with measuring it with an oscilloscope, or make a divider/level translator feeding a counter like 4040 and see if some of the higher order output pins will reveal a change between 0V and Vdd (B+).