Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

uC project

Status
Not open for further replies.

electroRF

Member
Hi,

I'm thinking of taking a certain project.
I'd like to have my laptop to communicate with a uC via USB to Serial Communication (I'll program that communication by myself) and have the uC communicating via SPI / I2C / etc to another chip which will perform a certain action.

Could you give me an idea for that chip and its action it could perform, something useful perhaps.

The whole idea is working on my low-level programming skills while learning communication methods.

Thanks.
 
Last edited:
Here's some I2C devices you could connect to: **broken link removed**
Some SPI: https://www.mct.net/faq/spi.html

or you could just google "list of i2c devices" or "list of spi devices".

For a bit of a challenge you could make an audio output device (similar to a sound card) - you send the data to it and it plays the sound. Using an I2S DAC should make it sufficiently challenging/infuriating to keep you busy.
You could also just do the usual temperature sensor interface or perhaps an IO expander to drive some LEDs...
 
I've recently written some code to test pressure sensors, the pic talks to the sensor in i2c and then relays back to the pc in rs232.
The pic 16f628 has a very nice serial port that does most of the rs232, and the ssp does a lot of the i2c.
 
Hi mates, thank you very much.

dougy, I liked your idea very much.
What does I2S stand for? (____ to sound)
Could you specify please such I2S DAC?

I drew the block diagram of the whole system.
Did I miss any block? (or got something incorrect).

View attachment 68283

I assumed that a uC cannot communicate directly to a USB port.
Maybe I'll use the Serial Port of the laptop instead of the USB port, to spare the USB2Serial block.

What kind of sound will I be able to produce?
I mean, would I be able to produce only single-tone sine waves?

Thank you very much.
 
Last edited:
What does I2S stand for? (____ to sound)
Could you specify please such I2S DAC?
Apparently it's Inter-IC Sound
https://en.wikipedia.org/wiki/I²S
https://www.electro-tech-online.com/custompdfs/2012/10/I2SBUS.pdf
Could you specify please such I2S DAC?
You should probably try an SPI DAC first; it'll be much simpler. The I2S timing is a little tricky using the SPI module. The choice of DAC for you I guess depends on which electronics store you purchase from.
I assumed that a uC cannot communicate directly to a USB port.
Maybe I'll use the Serial Port of the laptop instead of the USB port, to spare the USB2Serial block.
Using the serial port will probably limit your datarate to 11520 bytes/second, so expect the sound quality to be worse than FM radio but better than telephone. You'll probably want to use some sort of flow control also - either hardware (involves connecting an IO pin to the CTS line) or software; either can be used to tell the PC to stop transmitting when your uC has enough data, or to start transmitting when it wants more data.

What kind of sound will I be able to produce?
I mean, would I be able to produce only single-tone sine waves?
If you just pass the value received from the serial port to the DAC, you can have it play any sound from a .wav file on your computer.

PS your block diagram is correct. You will want to connect some sort of amplifier between the DAC and the speaker.
 
I can actually get rid of the uC, isn't it?
I mean, what its role?
You'll need to keep the uC there, as it has to convert between asynchronous serial (RS232/UART) to synchronous serial (SPI/I2C). It will also control the sample rate (timing) of the playback.
 
Hi again dougy, and thank you again for your help.

Aren't there DACs that receive directly serial information / USB information and convert it to sound?
 
Hi again dougy, and thank you again for your help.
Aren't there DACs that receive directly serial information / USB information and convert it to sound?
Yes, you can get a complete USB 5.1 sound card in a single IC, but I would think that defeats your goal of "The whole idea is working on my low-level programming skills while learning communication methods.".
 
Hi dougy.
Thank you.
You are correct.
What I mean is that I wouldn't want the uC to be just a asynch to synch converter.
As I understand, a real sound card doesn't comprise an uC, as it is not necessary.

I received a nice idea from edeca.
Using a uC to program an LCD.
I'm thinking of something like this:
Block #1 Laptop Serial Port --(Serial)--> Block #2 uC --(I2C)--> Block #3 LCD

At first stage, I'll build 2nd and 3rd blocks (i.e. the images will be hard coded in the uC memory).
Later, I'll let the user to decide on the image presented via the laptop.

What do you think of it?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top