Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Programming Questions / Serial port issue... on: November 16, 2013, 11:15:25 pm
Hey guys, it's been a while since I posted anything recently here, but I need some help.

I've been working on a virtual reality glove to go along side of the Oculus rift. It's pretty cool as is, but definitely not fixed. Problem is, all of a sudden, it's stopped talking with Unity. If I open up the arduino software, the serial monitor works fine. But when I use the serialport.open, it just freezes, and will eventually tell me the port does not exist (even though it shows in control panel, and I can connect with the serial monitor without issues) Any clues as to why when it was working just a week ago and no change has been done to the code on either end?

I know this is a fairly specific question, and I know it's not really something that's done a lot. (input from arduino sent to unity and such) I'd appreciate any help that can be given though.

C# code
Code:
SerialPort serial;
serial = new SerialPort(comPort,speed,Parity.None,8,StopBits.One);
serial.DtrEnable = true;
serial.ReadTimeout = 1000;
serial.Open(); //Line it freezes on
serial.WriteLine("1"); //added to not fill the buffer before connecting
while (serial.IsOpen && !isClosing)
{
try
{
parts = currentLine.Split(',');
}catch{
attemptsToStartConnection += 1;
if(attemptsToStartConnection >= 5)
{
serial.Close();
break;
}
}
}
serial.Close ();

arduino code:
Code:
int wristX;
int wristY;
int wristZ;
int elbow;
int indexFinger;
int ringFinger;
int elbowX;
int elbowY;
int elbowZ;
bool startSending;

void setup() {
  Serial.begin(9600);
  while (!Serial) {}
}

void loop() {

  
  if (Serial.available() > 0)
  {
    startSending = true;
  }
  if(startSending)
  {
    wristX = analogRead(A0);
    wristY = analogRead(A1);
    wristZ = analogRead(A2);
    elbow = analogRead(A3);
    indexFinger = analogRead(A4);
    ringFinger = analogRead(A5);
    elbowX = analogRead(A6);
    elbowY = analogRead(A7);
    elbowZ = analogRead(A8);
    Serial.flush();
    Serial.print(wristX);
    Serial.print(",");
    Serial.print(wristY);
    Serial.print(",");
    Serial.print(wristZ);
    Serial.print(",");
    Serial.print(elbow);
    Serial.print(",");
    Serial.print(indexFinger);
    Serial.print(",");
    Serial.print(ringFinger);
    Serial.print(",");
    Serial.print(elbowX);
    Serial.print(",");
    Serial.print(elbowY);
    Serial.print(",");
    Serial.println(elbowZ);
  }
}

EDIT:
If you wanted to see some of what I've got done, you can check out the video here.

Unfortunately I'm not really all that use to serial connections, and have battled with it quite a lot. T_T
2  Using Arduino / Motors, Mechanics, and Power / Sensor/motor in one? (need input and resistance) on: December 13, 2012, 04:40:43 pm
Ok, so I have an idea that I want to throw out there, but I'm not sure how practical it is. I was thinking of how to create something like a pair of gloves for use in a 3d environment. Now I obviously don't mean the real world, but virtually, like in a game. My basic idea originally was to have some form of spring loaded potentiometer for each finger. This means it'd turn all the way on when a fist is made and all the way off when fingers are open wide. Attach a string on the potentiometer, attach the other end to the finger tip, and have rails or a sleeve that keeps the string on each finger. As you bend your fingers, you pull on the potentiometer making the values increase/decrease.

While this is a sound way of doing it, it also doesn't give any feedback. Sure, you could have a vibrating motor to let you know you are holding something, but it wouldn't work as far as making you feel like you've grabbed something. My current idea is to have something like a small servo motor to pull on the string when the 3d engine finds you've "grabbed" something.

With all that explanation, I guess what I'm wanting to know is, is there something that works like a servo (not strong enough to hurt anyway) that also can double as a sensor (reading being pulled on or released)??

If not, I'm sure I could just use a combination of a weak servo with a custom built spring pot system, but that's extra work and inputs/outputs, so I'd rather have it all in one. Any ideas?

(This is all an in my head project at the moment, but It'd be cool to work on it when I get some extra cash on hand.)
3  Using Arduino / General Electronics / What knob do I need to get? on: November 12, 2011, 07:44:33 pm
So, I'm looking through sparkfun and mouser, and found a few things I'm thinking about getting. One being a rotary encoder ( http://www.mouser.com/ProductDetail/Mountain-Switch/101-5433-EV/?qs=sGAEpiMZZMsWp46O%252bq11WRIJDQMnvPzavplQFZYfB2M%3d ) and I can't find anything saying what size knob I would need to get.

Can anyone give any help on this? (This would also pertain to potentiometers.)
4  Using Arduino / Networking, Protocols, and Devices / I think this is the right forum (bluetooth module) on: October 26, 2011, 03:10:23 pm
I've been wanting to get into using bluetooth with arduino for a while now. I just couldn't force myself to pay that much for them though. I'm looking at trying around $15 for the arduino and bluetooth module kind of cheap. So, I found this module on deal extreme that's only $6.60 USD( http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711 ). Dang good price for a bluetooth module from what I've seen out there. Only semi-issue is it's slave only, but that's not too much of a biggie for me.

Anyway, I've never worked with arduino and bluetooth before. Is it really as simple as hooking up the tx/rx of the module to the tx/rx of the arduino? That just seems a bit simple. My first little invention I'd like to do is make a simple bluetooth controller for an android device. I am guessing it can be fairly simple as just emulating a keyboard, though I'd like to have support for analog as well. Any ideas on this also? How would I go about getting it to show up as either a keyboard or joystick/gamepad?

Thanks for any help/insight you can give! ( I swear I start way to many projects.)
5  Topics / Product Design / Re: inflatable window curtain that inflates/deflates based on light on: October 11, 2011, 02:16:39 pm
Light sensors (can also be photo sensors or a photocell) are fairly simple, and semi-cheap. You can look at all the normal electronics websites to find some. For example Sparkfun had these:

http://www.sparkfun.com/products/8348
http://www.sparkfun.com/products/9088

Both are fairly easy to understand. I don't think you would need a sensor for each individual blind piece though, just one sensor for an entire column maybe. Really, that's up to you, since it's your design, but why spend the extra money on extra sensors if it's really not needed. Blinds will generally have the same brightness on them at the top as at the bottom.

As far as the sensors being inside, either of those would work. I don't really understand the idea a ton except it's effectively filling a "bag" with air, and then sucking it out. smiley-lol I'd do the more simple approach of having a stepper motor turn regular blinds up or down based on daylight, but that's me, simple in nature.

O-o I feel like I'm rambling. Anyway, Pretty much all photo/light sensors work in a similar way. They either give or take resistance based on the amount of light they have. If it's lower then a certain amount then it would be triggered as off, and above that certain point would be on.

smiley-lol I feel like my post was kind of rambly and pointless... but, the point is, that's what they are, and a place you can get them, and a brief (and probably horrible) explanation of how they work. Sorry if it was a horrible post. (brain isn't working well today...)
6  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Uno and serial communication via USB on Windows 7 64 bits on: October 11, 2011, 11:53:20 am
I have had no issues with getting my arduino to work after the proper driver was installed. (win7 64-bit) Sounds like a driver issue to me. Either that, or the sketch wasn't uploaded to the arduino properly, or the wrong comm was selected. Also verify the baud.
7  Using Arduino / Interfacing w/ Software on the Computer / Re: LED processing.. how did this guy do this? on: October 11, 2011, 11:46:39 am
The gui probably just has a simple serial interface set at a high bitrate (19200 would probably be enough bandwidth for this.) and a matrix (like any other led matrix) that controls relays rather then leds. Also, by the looks of things, it didn't support using rows, only columns, so it probably didn't even have a matrix, just relays for the entire column.
8  Topics / Product Design / Re: ATmega4 vs ATmega8 vs ATmega328. Project use? (question) on: October 11, 2011, 02:39:56 am
@CrossRoads: I have no clue how to program with standard avr. Not even a smidgen smiley-razz That's why. Have any resources for newbies that my be useful? If it's easy enough and such, sure I'd be interested. It would let me program for a much more broad amount of micro controller ic's.

@cr0sh: You're right, it is a 48, not 4... but has what you might expect by just being a 4 for the specs. http://www.mouser.com/ProductDetail/Atmel/ATMEGA48A-AU/?qs=sGAEpiMZZMuHCAZ7U3Ea2oLmFWtgS%2fZs
Only 4kb of memory and .5kb of ram.
9  Topics / Product Design / Re: Custom Arduino 3.3v quick questions. (shouldn't be too hard) on: October 10, 2011, 04:24:58 pm
As far as the 8mhz, I've never gotten it to load right. Well... Should I say, the boot loader uploads (blinking pin 13 led), but I can't ever get it to upload programs after the fact. I tried on four different ATmega328's. They were powered at 5v, but I didn't think that it really mattered.

O-o what about running an atmega8 at 16mhz at 3.3v? Would that cause problems? (I would guess about as many as the 328, but since it's running less memory and ram, may draw slightly less voltage for it)

Also... O-o what do you mean by bypass capacitor? (overall, fairly new to electronics. I understand the need of resistors in most situations, but I thought it was to drop overall voltage, not current, smiley-lol Looks like I got those mixed up. *sigh*)
10  Topics / Product Design / Re: ATmega4 vs ATmega8 vs ATmega328. Project use? (question) on: October 10, 2011, 04:06:13 pm
Thanks for pointing those out. I'd still like all the outputs though. The closest is the ATtiny2313, with 18 i/o pins, which would actually be fine, but if I can use the ATmega4, I'd still have all 20 i/o pins at the same cost. (atmega4 on mouser is $1.77 so if it's possible to use it, it'd be at the same price)

The ATtiny25 is cheaper on mouser also, ($1.18 for single) but it still only has 6 i/o pins. Super small projects would be fine, but not for the gadgets I have in mind every once in a while.

I've searched for arduino on the 4 and 8, and found stuff about it on the 8, but not the 4. Is that because of the size of the bootloader maybe?
11  Topics / Product Design / ATmega4 vs ATmega8 vs ATmega328. Project use? (question) on: October 10, 2011, 02:49:53 pm
So, as I've stated in a different post, I'm working with making an arduino system that's practically an led control kit. I also found online that the ATmega4 and ATmega8 performs the same as a 328 as far as speed, power consumption, etc. I was just wondering is there any reason an ATmega4/8 can't run arduino? The main reason I ask is, because I'm not too worried about 8kb of space on the ATmega8 being to small (most programs that I'd be writing to it would be at most 100 lines) compared to the 328' 32kb (... I now get the naming convention of the 328.... smiley-lol), I am kind of worried about the 4kb of the Atmega4, with the bootloader on it. I don't think the application of turning on and off leds is very ram intensive, so the extra 1kb ram from the 8 isn't really needed (script doesn't use many variables either).

So... O-o I guess what I'm asking, is the ATmega4/8 compatible with arduino?

The main reason I ask is because an ATmega4 is only $1.77, ATmega8 is only $2.30 where as the 328 is $3.42 (all surface mount, all not pre-programmed, from mouser). Sure, in the short term, it isn't that much of a difference in cost, but the cheaper I can make my own chips, the more neat little toys I can make smiley-razz. I think my total build cost per unit would be less then $5 per unit if I can just use the ATmega8, and possibly even less then $4 with the ATmega4.

Are there any other cheaper alternative chips like these that do work with the arduino bootloader?

(>_< sorry for the two different posts so quickly together, but they aren't really all that related)
12  Topics / Product Design / Custom Arduino 3.3v quick questions. (shouldn't be too hard) on: October 10, 2011, 10:47:10 am
Ok, so I've designed a smaller arduino circuit then my last one. It's pretty much meant to be an LED controller and that's it, so I don't need the 5v for extra circuits or anything. I've only got a few small questions.

#1. Do I have to do a special bootloader?
#2. Should I attach a 3.3v line to the Aref for buttons/knobs?
#3. Being that the led's are tolerable up to 3.5v, do I even need to use resistors on it? Seems kind of pointless if it's within the voltage range. (If the arduino were outputting 3.5v and higher, there'd be something wrong with the arduino if it only had a 3.3v input right?)

That's it. I don't think they are that hard of questions.
13  Topics / Product Design / Re: PCB Design Services? on: October 10, 2011, 10:42:38 am
Have you tried these tutorials? I found the others on youtube to be crap, but this one got me going in Eagle in only 1-2 settings. If you haven't, maybe try it? They are only like 1-2 hours all total, and explain both the schematic and pcb section all the way to a finished product.



If you need any help past this, I'm sure many on here would help. (I would if I were on here more often.)
14  Using Arduino / Networking, Protocols, and Devices / Cheapest bluetooth chip? (Wanting to make a bluetooth controller) on: September 24, 2011, 06:11:22 pm
Ok, so what I'd basicly like to do is make a simple controller for use with my android phone for emulators, and other games that may support a bluetooth keyboard, or somehow simulated to android.

So, I ask, what is the cheapest bluetooth chip that can be used with arduino with out a massive effort to get it working? I'd like to make a small controller that attaches to the side of my phone to add in a physical gaming controller. Goals would be at least a d-pad and 4 buttons. (probably a few more buttons, but that's the minimum I'd want. Any help with ideas of the best way to pull it off would be nice. Right now all I can really think to do is have a program run in the background reading a bluetooth serial connection.

(Please note, I know that there are some bluetooth controllers out there that work, but I'd still like to make my own, as most are over priced and way to bulky for me)
15  Using Arduino / Microcontrollers / Re: Install Bootloader to use 8Mhz internal resonator - and upload program after? on: May 20, 2011, 05:15:01 pm
Anyone figure this out fully?

I ask because I'm working on trying to make a 1inx1in arduino circuit using the 328p (smd), and while I have all 20 output pins, and it could be programmed through ftdi and a breadboard, I forgot to put in a crystal, and after diodes, voltage regulator and capacitors for the vreg, I'm out of space. Using the internal 8mhz would be amazing. Unfortunately, I have absolutely no place left for the crystal, as it was tricky just getting all 20 pins, 4 grounds, and the input voltage/ground on the circuit with the limitations of the pcb process sizes (I use 8mil spacing to be safe)
Pages: [1] 2 3 ... 5