Using the Nano as a general purpose analog input for the PC

I’d like to be able to use the DSO nano to measure things and read the nano into BASIC programs. I’m using Liberty BASIC, which I highly recommend, and want to read voltages into the BASIC program. Is there a way to do this? Can the nano look like a virtual com port? How might one do this? Thanks. Irv

You would need to re-write the program to do it, and it’s feasible.

I hope somebody that knows how to program the nano will take this on. It would make a dandy thing to have. Here’s how I see it, functionally:

Say you want to monitor the voltage on a battery, periodically. Hook the Nano up to the battery and also to the PC via the usb cable. From BASIC, C, or whatever, you read what the scope says for voltage at that instant. You do it by creating a virtual com port (see FTDI website. The software is free), which looks just like any serial com port to the computer, and send out a “R” or some character to initiate a read, and the Nano replies with the current voltage via serial port. This could be expanded to read out not just voltage, but frequency, duty cycle percentage, FFT spectrum, etc, etc. The list goes on.


you opinion is good .but i think something you slould notice:
1.“You do it by creating a virtual com port (see FTDI website. The software is free), which looks just like any serial com port to the computer”
but ,actlly ,there is no USB-UART chips in our DSO NANO .the USB communication is PC -STM32 . no USB-UART chips inside… so ,the PC do not recognize DSO as a virtual com port… if you want to use the USB to communicate with PC ,maybe you should get to know STM32 USB functions…
2. it is a good idea to treate DSO just a input,and sent all the data to PC via USB ,PC deal all the data with any porpose.but actully we have always treate DSO as a equpment .with no PC assistance . pls go on your reseach if you have interests in this ,wish your success…

Ok. Didn’t know that it was not using virtual com ports. I’m not a programmer, so I cannot proceed at all. I hope someone else does, though. It would be a very useful tool.

That is a cool idea, and it can be really handy if you need a simple acquisition card and you have the Nano laying around.

The simplest way to do this would be to use the existing USB mass storage interface: Just let the Nano write the current values into a file, then your application on the computer can reread this file all the time… The trick is just to use a “virtual” file without having to write to the SD card for real.

However, as suggested above, the STM32 can act as a USB-serial device (virtual COM port), and the firmware code is available in ST’s USB device library examples*. It can also be a USB HID interface which is a good alternative since there are standard HID protocols for such things as measurement devices.

To do it properly, you would add a second USB interface (in addition to the mass storage one). I haven’t seen examples of this, and I don’t know if the ST USB stack needs much changes to accommodate this, but it should not be too difficult. The new interface can be a virtual COM port, an HID interface or a custom USB class for which you make your own driver. A driver-less application is easy to make with libusb and for instance pyusb for python. I would recommend someone who want to try this out, to first deactivate or replace the mass storage interface with the new interface, and once you have this working, go on to make the device run with both interfaces.

I probably won’t find time to work on this myself, but I can offer help and guidance to some extent.

*) The new ST web site suck trees, but if you go to -> Resources -> Tools/Firmware you can find the USB Device library (UM0424).