Okay so the problem isn't that there is no host? Because I was trying to do this first with USB to TTL adapter but I found out that I couldn't do this without USB host (according to what I found on the internet)..So I bought a USB host shield for Arduino but there was problem with the code..
You have not ever used the USB to RS-232 cable with success.
To get it to work with the PC would (probably) require a driver you might not have aready installed.
I think it should "just work" with the anemometer, but so far evidence suggests it is not. Just working.
A possible experiment, but a painful one, would be to use the USB on the Arduino to connect to the USB on the anemometer.
I say painful, what I mean is less than ideal as it will involve downloading the simple test code, disconnecting from the PC, powering the Arduino other that through the USB connector, connecting it to the anemometer and… seeing what you get.
When you connect the anemometer to your PC, does it appear as another COM port in Device Manager, or does it appear as a completely different device type?
Would it be better if I shared link to the components that I'm posting here?
The USB host library has examples od codes on how to communicate with devices using this shield (like Xbox etc.):
And there are also drivers like pl2303 and so on but according to what I found, if those examples don't work for me, my device is probably using something else and solution is to write my own code to start such communication (and I have no idea whats in my device or how do such thing)
Yes I did. I connected this cable with USB to my computer and on the other side (RS232) I connected pins RX and TX.
Yes, it is. The cable is fine. It's just wierd that when I connected this one to PC, the CoolTerm is really slow..even when I want to send something it takes time. When I connected anemometer right away everything it's okay. I don't know if it means something, just mentioning.
EDIT: Also I noticed that there is a little light on the RS-232 connector (on USB to RS232 cabel) and when I connected it to the PC, it lights up...when it's connected with anemometer it doesn't
Okay, thank you and for your help. I hope I will figure something out.
Just my opinion, but the USB host shield you had in post #25 is the piece of kit I would be thinking of. You need to check to see if the library for the host shield supports serial comms - there's a fancy USB speak name for it - might be CDC class - but i'm not sure.
The official Arduino docs for their shield say:
The following device classes are supported by the shield:
HID devices: keyboards, mice, joysticks, etc.
Game controllers: Sony PS3, Nintendo Wii, Xbox360.
USB to serial converters: FTDI, PL-2303, ACM, as well as certain cell phones and GPS receivers.
ADK-capable Android phones and tables.
Digital cameras: Canon EOS, Powershot, Nikon DSLRs and P&S, as well as generic PTP.
Mass storage devices: USB sticks, memory card readers, external hard drives, etc.
Bluetooth® dongles.
So I think you were on the right track with that sort of shield.
No. I think you need to keep it all USB in order for the setup to work.
is it a pure standard USB-cable with on one side a small USB-mini-plug and on the other side a USB-A plug.
Both beeing as small and flat as in tis picture
Or does this "cable" have a bigger housing that has a TTL to USB-converter inside?
Best way would be to post a picture of the real anemometer with its real cable one picture showing the anemometer with plugged in USB-cable
one picture showing the opposite end plugged into your computer
From what is being described, I believe it to be a straightforward USB cable. When the anemometer is plugged into a PC using the USB cable, it enumerates as a COM port. The documentation I found stated that the sensor has a USB port - likely an internal Serial-USB chip.
@StefanL38
Yes, it's that USB cable - one side USB mini plug and on the other USB A plug. Sorry, I thought it was clear.
Yes, it is.
Hm, I don't see anything like that, but I will look at it again.
I thought it would be easier use RS232 because of the code. But maybe you are right.
If I got it right, you used that shield before (or something like that). It connects on the top of the Arduino..is it possible to use the Arduino as before? Or all the other sensors etc. that I'm planning to connect to the Arduino Mega will have to be on other Arduino. Maybe silly question, I'm sorry
As with any shield, you would need to know which pins it used on your particular Arduino.
It seems that the original Arduino USB host shield didn't support serial comms, but there was a newer version that did. Your photo looks to be of a different USB host board. Do you know which one it is? What chip does it use to perform the USB functions? Did the board specify a library to use with it?
A quick search shows that the MAX3421 does support serial comms.
The Arduino USB Host Shield 2.0 uses the MAX3421 and the website of the board you linked to links back to the Arduino USB Host shield library. There's a good chance that the board you have is possibly a clone of the now discontinued Arduino shield. The Arduino documentation page here:
has a schematic of the shield, which shows the use of the SPI interface. Multiple devices can share the same SPI bus pins (MOSI, MISO & SCK) so that shouldn't be an issue. The board seems to be hard wired to use D10 as the SPI SS signal. You will have problems if another shield is also hard wired to use D10 as its SPI SS signal.
The Arduino library appears to have an example sketch called USBFTDILoopback.ino which I think would be a good starting point.
Also a search with your preferred search engine for "arduino usb host shield serial communication" should get you a fair bit of guidance on how to configure the shield for "serial" comms.
my attempts with USB host shield were not successful....So I bought RS232 host shield on Arduino. But I found out that the problem ist RS232 to USB cabel I'm using. It's powered from USB and it expects host device on USB side, not RS232. So thats why it worked with computer and the little led on the cabel lights up when I connect it to computer.
Thank you all for you advices, help and time I appreciate it