I'm working on a modified guitar project using an arduino micro board.
I have very little place inside the guitar, not enough to plug an USB micro B cable (that is connected to a raspberry on the other end).
I need to reduce the size of the electronics part to its minimum.
I was wondering if it could be as simple as :
cut a USB cable
connect the wires to VI, GND, Rx and Tx
Would that replace the USB connection identically ?
If so, which USB wires correspond to Rx and Tx ?
I thought that maybe Rx / Tx and Data+ / Data- could have exactly the same function, as they are dealing with bidirectionnal serial connection, and as I'm not a specialist at all.
So I can connect my black and red USB wires to GND and +5 pins respectively.
But where can I find the Data+ and Data- lines on the micro ?
I see no mention of them on the pinout diagrams ...
You get all the electronics set up, coded and working using the parts in their original, un-modified form, before you even dream of being concerned about how to "shrink" it to fit in the guitar.
I'm not sure to understand your reply ... which is not an answer to my question, anyway.
Actually I'm not a specialist but I'm not a total newbie, despite I never posted on this forum (I'm more a programmer than an electronician).
Everything I need is working fine : sensors, arduino code, communication with raspberry Pi, and sending OSC data via wifi from the raspberry using Pure Data.
Now I want to integrate the electronics into the guitar and I want to build something as clean as possible.
In fact I could use a USB micro B plug, but this seems an ugly solution to me because I would have a fat cable running in the middle of smaller electronic parts.
Or maybe the meaning of your reply is that I should have thought about everything before going into the realization ?
Yes, you're right.
Anyway that doesn't help me that much ...
Does someone know about which pins I could use as USB Data+ and Data-, and if this is possible without any extra circuitry ?
This seems possible according to Simpson_Jr's reply ... but I miss some information.
But an alternative way to connect to a Raspberry Pi is to use i2c. It would be simplest if you could use a microprocessor running at 3.3v inside of the guitar, so that you don't need level shifters from the Pi (3.3v) to the embedded processor (Arduinos historically run at 5v). You would need 4 wires to the processor, power, ground, SDA, SCL.
Depending on the embedded processor, you may need to add 7.4K ohm pull-up resistors between both SDA and SCL and the power wire, but you can do this on the R-pi side of things.
In this case you would using the microprocessor as a slave instead of the master (most of the i2c examples are targeted towards the Arduino being the master).
josephlarralde:
Does someone know about which pins I could use as USB Data+ and Data-, and if this is possible without any extra circuitry ?
This seems possible according to Simpson_Jr's reply ... but I miss some information.
I'd double check wires by the way, in 9 out of 10 times red indeed indicates a positive voltage and black ground, but it's better to be safe as sorry.
USB stands for Universal Serial Bus and it indeed uses serial communication, but it works quite different compared to a rs-232 or comport- connection. Several types of serial connections are possible, you can use I2C- and SPI- connections as well for example, but the devices communicating need to use the same protocol in order to work. I believe it is possible to use SPI and I2C on an Raspberry as well and if you would like to, you could... in theory use those to communicate as well.
One thing that I wouldn't like is that you'll only be ably to upload sketches using your raspberry, but as long as you can it doesn't have to be a problem.
OK, so given that you already have the electronics and code working and performing exactly the task you want, then at this moment you already have the Arduino Micro connected with a cable using a micro USB plug.
Your question then is - how to remove the socket from the Arduino Micro, cut the plug off the cable and wire the cable directly to the pads on the Arduino Micro PCB itself.
This is certainly do-able, the links Simpson_Jr has given you (including the sub-link for the Micro-USB connector pinout) detail the standard wire colours in order to match the pins on the Micro-USB connector where it was mounted on the board. It would however, require you to desolder the SMD Micro-USB socket from the board which requires considerable skill and similarly, solder the wires in its place. Having done so (and verified success), I would advise you to tie the cable securely to one of the adjacent corner holes in the Arduino Micro PCB and encapsulate your new connections and the end of the cable in a blob of epoxy, never to be altered.
I have to use a USB chord because for me, connecting the Arduino via USB to the Raspberry and getting the data with Pure Data software (using the "comport" object), is the simplest and most evolutive solution.
I'll check the I2C and SPI solutions, thanks for your tips, Michael and Simpson_Jr.
But as you say Paul, this is what I feared : for USB the only other way is to solder the wire directly onto the board in place of the female connector.
Difficult job, so finally I managed to put the arduino another way so that I can keep using a micro USB plug.
I don't recognise the sound pickup device and all the wires going to it.
If you are going to put such electronics into an audio device, I think the "dress" of the audio cables could be better - shorter wires outside the shielding.
Clearly, you have in fact, been doing a fair bit of dicing and splicing with the USB cable anyway.
It's normal that you don't see the microphones wires, because they are still unmounted on the photo.
I'll try to let as little naked wires as possible ...
I fear to hear some parasites from the electromagnetic activity of the arduino when I wire everything back, but as this guitar is a prototype, it will be the occasion to hear if it's really the case, and if the noise is too disturbing or not.
I hope not, or else I will have to find some shielding solution.
At least I was getting my sensor's info into my computer when I last plugged everything in.
For the ones interested in similar projects, I started from this tutorial :
I thought that maybe Rx / Tx and Data+ / Data- could have exactly the same function, as they are dealing with bidirectionnal serial connection, and as I'm not a specialist at all.
So I can connect my black and red USB wires to GND and +5 pins respectively.
But where can I find the Data+ and Data- lines on the micro ?
I see no mention of them on the pinout diagrams ...
MOHAMMEDIBRAHIM:
Sketch uses 4166 bytes (12%) of program storage space. Maximum is 32256 bytes.
Global variables use 101 bytes (4%) of dynamic memory, leaving 1947 bytes for local variables. Maximum is 2048 bytes.