I'm doing a project, to help develope a Hardware in the loop application for Audioprocessing.
In this project, i will recieve some configuration through UDP from PC, and the UDP datapakage contains something like "FFT Length", thus i should implement a Simulink model, that set the FFT Length or "Data Length" dynamicly.
Here is the thing i already have ( It is TI C6455 DSK Board):
UDP Server is already implemented and packed as a Subsystem with one output Port (Signal), whitch is the FFT Length recieved
the Simulink ADC and DAC Block for the Boards, with fixed Sample per Frame (linke 256 Samples per Frame, and Sample Rate of 48kHz)
FFT Block with the FFT Length set to "Inherit FFT Length from Input"
now i'm considering using Buffer-Block to implement that, but there i have some troubles:
Buffer-Block don't have a Port whitch can dynamicly change the output length
Buffer-Block caused the unstable Spectrum output
Anyone can help me, so that i can solve both problem?
Thanks a lot
Related
I have created an OFDM signal (WLAN) in MATLAB and saved the complex valued signal in a file. I then transfer the file to USRP-B210 (Software Defined Radio) and transmit over the air. Note that in MATLAB, I do not require to up-convert the signal to IF(intermediate frequency), as it is done by the radio device itself.
The signal is received by the receiver (which down-converts) and saves the file in local disk. I then process the receive file in MATLAB. Everything works perfect, and data is decoded correctly.
Now, I want to apply a Rayleigh Channel (that has Delay-Doppler effect over multipath channel). MATLAB has built in function for that Fading Channel. In such case, my signal transfer works fine with minor degradation in performance (BER). But degrades as I increase Delay-Doppler effect.
My question is, while I use the channel model, I am not doing any upconversion of the baseband signal before passing it to the channel model function. Was that necessary ? Because applying channel model on the base band sounds incorrect. In that case what other options do I have ?
I am not super familiar with this toolbox from MATLAB, but a quick look at the help page for comm.RayleighChannel doesn't seem to show any inputs that are carrier frequency based. This would imply that the channel model is carrier independent. As such, it should be able to be applied to a complex baseband signal just as readily as to an upconverted pass-band signal.
rayChan =
comm.RayleighChannel with properties:
SampleRate: 100000
PathDelays: 0
AveragePathGains: 0
NormalizePathGains: true
MaximumDopplerShift: 130
DopplerSpectrum: [1x1 struct]
ChannelFiltering: true
PathGainsOutputPort: false
I am running a code on arduino which works fine in arduinoide, I want to get those values in simulink for real time using serial connection.
I am burnig a program in arduino and want to access both send and receive function of serial monitor, on simulink. I want these to plot graphs in real time and run PID algorithm using simulink.
But for some odd reason, simulink values are either not updating(in external mode) or fluctuating some odd values(in normal mode). Any help.
If you are doing a communication between the Arduino and Simulink there might be some problems in your connection. I'm assuming you are using the Serial Send and Serial Receive block to do the communication.
I did a complete tutorial how to connect both platforms in my Github page.
By your description I can think of this problems:
Simulink is not updating?
If your Simulink is not updating probably because it is waiting Arduino to send some serial data, but is not receiving anything. Some possible causes of this problem might be:
Wrong Serial baud rate
Wrong data type (i.e. If you are sending Arduino float you have to receive a single in Simulink.)
Wrong data size
Different step time (Remember to use the same step time in Simulink and Arduino)
Simulink receiving odd values?
If Simulink is updating but showing odd values, the communication between both might be damaged.
Desynchronization of the communication - Try to use a Header and a Terminator in the Serial Send and Serial Receive block and remember to set this in your Arduino code.
Different step time - Make sure both application are sending and receiving at same rate.
Verify what you are sending - You can check what exactly you are sending to the serial with a scope, remember that in the Serial Send block the input signal must be a byte. If you are using a single or double remember to cast it to byte with a Byte Pack block.
i need some help understanding a specific serial port connection from a sensor. I need to read data from the sensor and make some calculations in matlab or c++ (i will decide later)
The manufacturer only gives a chart with the following details:
Sensor Serial Port
Pin Number Mode Pin Description
I Trigger Input
I RS-232 Receive
O RS-232 Transmit
PWR Sensor Power (DTR)
PWR/GND Signal Ground
Not Used (Reserved)
Not Used (Reserved)
I/O RS-485 B Signal Pin
I/O RS-485 A Signal Pin**
So my question is: OK i know that pin 2 is used to receive data but how am i going to decode the volts stream into integers for example for my program? Also, i know that pin 4 gives power to the sensor. How do i know how many volts it has to give? Generally how am i going to learn all these details since the manufacturer does not give it?
Do you think Serial Port Analyzer Software will help?
Thanks very much in advance.
You might want to search for "DE-9 pinout YourSensorNameHere" in google or This page might be of some use to you. With most RS-232 you only need pins 2,3 and 5. With out more specifics about your sensor there isn't much SO can do for you.
I am new to GNU Radio and I'm trying to transmit a value using it and the USRP B210 board.
I used Matlab to convert the value 0.121 to wav format then convert the wav file to .dat file using audio_to_file example in GNU Radio.
When I transmit the .dat file using the B210 and GNU Radio, I received a wav file but when I read the wav using matlab function (audioread()) I get a different value.
P.S.
Sample rate for the converted .dat file was 44100 Hz and 16 bits per sample.
The receiver and transmitter sampling rate is 400K Hz.
I used fm_tx4.py example from the GNU Radio package for my transmitter.
I used uhd_nbfm_receiver.grc for the receiver.
If you're wondering why your received signal doesn't have the same amplitude as your sent signal, you're not getting the very basics of radio communications: as there is no digital line between your transmitter and your receiver, power can go anywhere, and how much reaches the receiver depends on a lot of factors, including gain, antennas, distance, matching...
There will be a lot more things that are different on the RX side than they were on the TX side: Your reception has not been time-synchronized, so you might see a phase shift. You don't mention whether the receiver is the same, a clock-synchronized or an clock-independent B210, which means you have the general case, where no two physical clocks can be identical (yes, that's impossible, but you can reduce errors), so you'll generally see some frequency offset, too.
I recommend reading up a bit on basic radio comm theory, I often recommend GNU Radio's pictured introduction, and GNU Radio's suggested Reading Page. Michael Ossmann gets some recognition for his courses, too, so you should definitely have a look at them.
Also, all your data->Wav->transmit conversion is totally unnecessary. Matlabs fread/fwrite functions can read/store the native machine float format that GNU Radio's file_sink/file_source can store/read. See the FAQ entry.
I'd like to send multiple signals (4 inputs and outputs and 7 outputs) from my Laptop to a microcontroller. I'm thinking of using a USB to serial converter and multiplexing the data through the port. I'll need to write codes both in the laptop end and in the microcontroller to multiplex the data.
Eg:
Tx of microcontroller:
1.Temperature sensor ADC output->Laptop
2.Voltage sensor to laptop
3.Current Sensor to Laptop
4.Photodiode current to Laptop
So I need to write a program in the microcontroller to send the data in this order. How can I accomplish this? I was thinking of an infinite loop which sends the data with time delays in between.
At the Rx pin of Microcontroller,
Seven bit sequences. Each bit sequence will be used to set the duty cycle of a PWM generated by the microcontroller.
I also need the same multiplexing or demultiplexing arrangement in the matlab end. Here too, I'm thinking of allotting some virtual 'channels' at different instants of time. What kind of algorithm would I need?
In case you always send all the inputs/outputs at the same rate, you could simply pack them into 'packets', which always start with one or more bytes with a fixed value that form a 'packet header'. The only risk is that one of the bytes of the sensor data might have the same value as the start-byte at the moment you try to start receiving bytes and you are not yet synchronized. You can reduce this risk by making the header longer, or by choosing a start-byte that is illegal output for the sensors (typically OxFF or so).
The sending loop on the microcontroller is really easy (pseudocode):
while True:
measure_sensors()
serial.send(START_BYTE)
serial.send(temperature)
serial.send(voltage)
serial.send(current)
serial.send(photodiode)
end while
The receiving loop is a bit more tricky, since it needs to synchronize first:
while True:
data = serial.receive()
if data != START_BYTE:
print 'not synced'
continue #restart at top of while
end if
temperature = serial.receive()
voltage = serial.receive()
current = serial.receive()
photodiode = serial.receive()
do_stuff_with_measurements()
end while
This same scheme can be used for communication in both directions.