I am very new to SDRs and with little background on DSP. I installed the uhd drivers and dependencies and can run/build the c++ examples. If I run tx_samples_from_file or tx_waveform at the TX end and run rx_samples_to_file at the RX end, I get random characters in the .dat file. Please what is the function of rx_samples_to_file? I thought rx_samples_to_file is supposed to get complex IQ sampled data equivalent of the received samples.
Eventually, what I would like to achieve with the USRPs is to generate random integers, map and modulate with say QAM or QPSK and transmit with the USRP TX and receive with USRP RX using a simple RF1 (back-to-back) connection.
Please help
Generally speaking, You can find a lot of information about Ettus Research
hardware and software in UHD Manual, Ettus Knowledge Base and USRP mailing list.
I think that You can find solution to Your problem by consulting
application note Examples Provided with the USRP Hardware Driver (link is given below).
https://www.ettus.com/content/files/kb/application_note_uhd_examples.pdf
Ivan
Related
I'm never used NS3 before and I have a school assignment to plot throughput vs time and packet loss vs time. I know that just by running fifth.cc I'll get the congestion window data. I noticed I can see all the instances where a packet was dropped and I manipulated that data in MATLAB to plot packet loss vs time there. How would I go about to create a piece of code that would be able to plot these 2 graphs?
The topology is a simple TCP source and a TCP sink.
Thanks
NS-3 provides a gnuplot library that you can use to plot what you want.
See reference here (with examples).
There are also plenty of other examples of how to accomplish this. Take a look at the NS-3 Users mailing list on Google Groups.
I am doing a speech processing project with a Raspberry Pi 3 (running Raspbian) using a USB Microphone. I can see the Microphone show up as a selectable audio device for the Pi and it produces/captures sound perfectly.
I cannot figure out how to use this in my code; I have done a ton of research regarding this and have found some tutorials but nothing that making sense. I come from more of a hardware background and have done something like this with controllers where I hook up an actual Mic and process the Analog Signal into Digital on IO Pins; I am so frustrated with this that I am about to pump data over from an Arduino using a Mic and A2D conversion.
-------------------------------------------------------My questions----------------------------------------------------
1) I want to know how to access a USB data stream or USB device in C or C++. My Linux abilities are not the best. Do I open a Serial Connection or open a filestream in "/dev/USB/...."? Can you provide a code example?
2) Regardless of the fidelity of the USB Mic Input, I want to know how to access its Input in C/C++. I have been looking at ALSA but cannot really understand a lot of its complexity. Is there something that gives me access to a raw input signal on the USB Port that I can process ( where I extrapolate out frequency, amplitude, etc.)?
I have already gone through a lot of the similar posts on here. I am really stuck on this one. I 'm really looking to understand what is going on from the OS perspective; I'll use a library given but I want to understand how it works.
Thanks!
So an update:
So I did all of my code in C with some .sh scripts. I went ahead and figured out how to use the Alsa asoundlib (asound.h specifically). As of now, I am able to generate and record sound via USB Mic/Headset with my Pi 3. Doing so is rather arduous but here is a useful link (1).
For my project, I also found a CMU tutorial/repos for their PocketSphinx Audio Recognition Device at link (2) and video link (3). This project utilizes the Alsa asoundlib as well and was a great help for me. It takes a while to download and you need to crawl through its .sh scripts to figure out its gcc linking. But I am able to now give audio cues which are interpreted by my Pi 3 and pushed to speaker output and GPIO pins.
LINKS(1)http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html
(2)https://wolfpaulus.com/embedded/raspberrypi2-sr/
(3)https://www.youtube.com/watch?v=5kp5qpwVh_8
I am trying to implement a C++ code (using bluez 5.43 and dbus) to read advertisement packets from a BLE sensor. As per the bluez DBus docs, there is a StartDiscovery API that can be used to scan for nearby devices. However, I am unable to find any APIs to store/parse the advertisement packets from nearby BLE devices. The advertising-api.txt lists registeradvertisement API but as per my understanding, it can be used only for creating advertisement packets and not reading from an external device (or am I wrong?) Can someone please guide me on the correct way to get advertisement packets from nearby BLE devices using bluez and DBus?
Thanks for the suggestions everyone. I was finally able to get the manufacturer data by using Intel's tinyb library. It has an enable_manufacturer_data_notifications API which enables you to be notified whenever the manufacturer data changes.
The behavior you described in one your last comment is the right one (the advertising data is not beeing updated) : if I am correct a BLE device is not supposed to be up all the time, it can sleep or turn to low-power etc.
In this context, it is not weird that the data is in some way "cached". From my experience, when you perform a scan and discover a device (even if you don't Connect to it), the device information will be stored for some time.
In your case, that's problematic because you are passing data through the advertising. However there is a way to force bluez to remove all it's cached data about a device :
the adapter-api provides a RemoveDevice(object device) method. It takes the object path (eg "/org/bluez/hci0/dev_AA_BB_AA_BB_AA") as argument.
If you're looking for DBus bindings in C, I suggest GLib GDBus (you will find links at the bottom of this tutorial on freedesktop website : https://dbus.freedesktop.org/doc/dbus-tutorial.html).
If you are familiar with bluetoothctl (a tool to interact with bluez using commands), it was developped by the bluez guys using Glib GDbus and you can find the source code here (look at the bottom to find the command list) : https://git.kernel.org/cgit/bluetooth/bluez.git/tree/client/main.c
There are more straigthforward ways to use GDBus with bluez but bluetoothctl source code is a start and you'll find examples for pretty much anything that is possible to do with bluez =)
I am new to vc++, I have to create a simple vc++ application so that I can turn off or turn on an LED ( or an electrical bulb powered by a cell), How can I take the control out from my program, I would like to use a USB for connecting the output.
Is there any library available for implementing USB integrating in the program ?
Have a look into the FTDI FT232RL series of chips. They're so common that the driver is already included in most operating systems. It's a USB-to-serial device, but it has a "bit bang" mode which turns the serial lines into individually addressable IO lines that can be used either as signal lines for your own protocol, or to so simple things like drive an LED.
Hack a Day has a great tutorial on using this device to (believe it or not) blink an LED connected via USB, including sample code written in C. Find the tutorial here: http://hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode/
The chips are easy to come by. The chip itself costs about $4 on its own, or you can spend about $15 to get it on a breakout board with a USB connector and such. Many USB-to-serial cables or converter boxes, or even the adapter cables for older cell phones contain this chip inside to do the actual translation, so if you have such a thing lying around already, you may want to try it.
USB does not have any ability to drive a LED directly; you will need an interface circuit. That circuit will need driver software, and this will determine how the software will operate. It is impossible to know how to write the program without knowing the driver.
You might have better luck using the legacy parallel port rather than USB. I can't direct you to any resources, but a quick search (even here on StackOverflow) should turn up something.
I want to develop code to transmit data from system to PIC through USB.
Can anybody give good link regarding data transmission through USB.
because i am new to this.
NOTE: Very simple is code is enough to me.
Thanks in Advance
The PIC16F877 does not have a USB peripheral built in. I assume that the product that you are building is a "USB Device" and that the "system" that you are referring to will provide the USB host functionality. If this is the case then you will have to add a USB interface chip to your hardware to provide async serial to USB connectivity. Suitable devices are made by TI (TUSB series) or FTDI. You then connect one of these to the PIC internal USART and pretend that you are transferring the data over a simple serial port. If you are using a pc then the connected device will appear as a standard COMn: port.
I totally agree with the FTDI route, however if you're not looking for a UART tunnel over USB then you have to get a bit more in-depth.
You'll have to write the USB routines yourself or find libraries/projects for your processor. What you will definitely have to have is a fast clock - 12MHz is necessary More is better because on small uC's like these you'll spend most of your time just handling the basics of USB - signaling and so forth. You'll also need a fair bit of memory because the USB code takes up around 1.5K I think. Then you need room afterwards for your own code.
I've seen the V-USB (http://www.obdev.at/products/vusb/index.html). It's for AVR not PIC, but it says it provides all of the USB functionality you'll need and even provides vendor and product IDs for you to use (non-commercial I believe). There's also a PIC project for USB that doesn't run on the same hardware as yours here: http://www.alanmacek.com/usb/
To make the driver you'll have to use libusb - here's a link for the win32 version: http://libusb-win32.sourceforge.net/
It's surprisingly more simple than I had expected, but I just looked at example code and not actually made anything. Good luck!
As your task will involve Windows Device Driver development, I do recommend to downlaod and install the WDK and look through the contained sample USB drivers.
This might get you some hints about the complexity of the topic. Device driver development is not the easiest thing to start with.
Maybe you can start with UART communication (RS232).
check http://www.beyondlogic.org/usbnutshell/pic16f876.gif will surely help u
also
ttp://www.beyondlogic.org/usbnutshell/usb7.htm , type h in front of 2nd link.