Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 343
61  International / Deutsch / Re: Verständnis Adafruit INA219 Current Sensor on: May 30, 2014, 11:41:34 am
Wo genau misst Du den Strom? Vor oder nach dem Spannungsregler (Pololu)? Wenn es vor dem Regler ist, dann ist das vollkommen normal, denn Du verbrauchst eine Leistung und die setzt sich aus Stromstärke und Spannung zusammen.  Der Regler bringt einen gewissen Verlust (je nach Typ unterschiedlich), der auch noch variieren kann, wenn die Eingangsspannung sich ändert.
62  International / Deutsch / Re: Timer Interrupt C++ on: May 30, 2014, 08:20:57 am
Indem Du den Handler in C programmierst und die C++-Methode von dort aufrufst.
63  Topics / Device Hacking / Re: Controlling Automower on: May 30, 2014, 08:12:14 am
Code:
client.print("Stop");

gets

Code:
client.print(F("Stop"));

and

Code:
String command = client.readStringUntil('/');

maybe written as

Code:
#define BUFFERSIZE 40
uint8_t buffer[BUFFERSIZE];
uint8_t i = 0;
while (i < BUFFERSIZE) {
  if (client.available()) {
    uint8_t c = client.read();
    if (c == '/') break;
    buffer[i++] = c;
  }
}

you can then use strncmp() to compare the string to a fixed String and there is also a strncmp_P() version to hold the compare string in flash only and save some RAM. This code misses a timeout handling and other error handling (what if buffer overflows?).
64  Using Arduino / Project Guidance / Re: Need help in Communication protocol.. on: May 30, 2014, 07:29:35 am
You didn't fix the server part but playing around with the watchdog on the client side? I don't think that this will bring you forward. And the code is still not properly formatted.

The ATmega may wake up because the server is constantly sending data, have you thought about this?
65  Using Arduino / Networking, Protocols, and Devices / Re: Strange i2c (twi) failure with Arduino Yun <--> TinyAVR on: May 30, 2014, 04:19:28 am
Quote
First, I've already been through the mistake of the I2C pins being 2 and 3 instead of A4 and A5 on the Yun.
My wiring (Arduino Yun -> TinyAVR) is 3v3 -> Vcc, 3 -> SCL, 2 -> SDA, Gnd -> Gnd, and there are 4.7k pullups on SDA and SCL to 3v3.

There are separate pins on the UNO and the Yun called SDA/SCL that are wired to the correct pins on the processor for I2C communication.

Quote
I have additionally stuck an LED + resistor between SDA and 3v3 so that it will blink when there is bus activity.

What resistor value did you choose? That changes the pull-up resistor value is not a very good idea. You won't see the LED blinking anyway because it's much too fast to see.

Quote
What I'm seeing now is that my Yun code enters the I2C event handler function and crashes.

You do call Serial code inside the interrupt handler:

Code:
Console.println("Received data:");

That's a bad idea and logically wrong although it may work sometimes under special circumstances.

Code:
  Wire.begin(4);                // join i2c bus with address #4

Why is the Yun configured to be an I2C slave? Does it really make sense to make the Tiny the master and the Yun the slave? Please post the corresponding code on the Tiny.

Your code is just an excerpt of the complete code. Did you check that the error happens with exactly that code (and only that code)? If not, please post the complete code that really shows the symptoms you're describing. You may think that the rest is not relevant but that thinking may be wrong.

Try to eliminate the String class because it's cluttering up the memory with constant allocation and deallocation of buffers. Use c-style strings (character arrays) instead.
66  Using Arduino / Networking, Protocols, and Devices / Re: Due won't write I2C data when slave on: May 30, 2014, 04:08:32 am
If the Due is the slave what kind of device is the master? Did you check that the master does send the necessary clock signals?

Please show your code (and use code tags to make it readable!).
67  Using Arduino / Networking, Protocols, and Devices / Re: I2c data encoding - Synchronise many arduinos on: May 30, 2014, 04:04:20 am
Quote
Sorry, but I don't get it. What is the signal line? Do you mean the clock line?

No, any digital IO of the Arduino. As an example, you can use D3 for this but I don't know if this pin is unused in your design yet.

Quote
If I can synchronise different arduinos , I'll be using the same board : arduino uno.

That's fine but keep in mind that the UNO is not the most accurate of all types in terms of timing.

Quote
The number is not fixed there can be many sensors (up to 30)
But it would be fine if I can simulate from 10 to 20 sensors.

In that number I would choose cheaper variants than a complete UNO for every sensor but that's up to you to decide.
68  Using Arduino / Networking, Protocols, and Devices / Re: change I2C speed WITHOUT modifying library? on: May 30, 2014, 03:10:10 am
Quote
(You do know that ^ means XOR, not exponent, right?)

Although I actually do know I didn't realize, I definitely switch between languages too often. That's my error, please excuse. The good news is that just the calculation of the set speed is wrong, the speed itself is correct.

The correct calculation would be:

Code:
#include <math.h>
uint32_t i2c_prescaler = pow(4, TWSR & 0x03);
uint32_t i2c_freq = 16000000L / (16 + 2 * TWBR * i2c_prescaler);
69  Using Arduino / Networking, Protocols, and Devices / Re: change I2C speed WITHOUT modifying library? on: May 28, 2014, 02:24:37 pm
Code:
TWSR &= 0xFC;

that code clears the lowest two bits in the register, so TWSR & 0x03 is always 0 and 4 ^ 0 is 1 as you would expect. If you get the result 142, TWSR must have bit 0 set but I see absolutely no reason for that. To test, don't divide by 1000 in the print. What do you get then?
70  Using Arduino / Networking, Protocols, and Devices / Re: Arduino C++ comunication? on: May 28, 2014, 02:10:06 pm
Quote
Well if I could access the memory directly then all transport would be handles seamlessly?

I don't understand that sentence. I never wrote that you could access the memory directly, I just wrote that the EEPROM is accessible by the ICSP interface even without having a corresponding program on the MCU.

Quote
the problem is that most of my packets are just garbage, and it's hard to determine where the problem is because sometimes it works for a while and sometimes totally not. now it just doesn't.

That's quite a bit of code on three different platforms, did you wrote that yourself? As far as I saw in a quick overview you're just sending some few command bytes from the PC to the Arduino and the Raspberry Pi is just the media converter. I would suggest to get some complexity out of that setup. It would be much easier if you use either an Ethernet shield on the Arduino and get the network commands directly or a Yun where you have the Linux system embedded and you get the network commands also almost directly, at least without having to provide a layer for the Linux side.

You should establish a stable protocol, either by giving the sender feedback if the command was received or by defining start and end sequences so the Arduino could parse the serial input and determines the packet start that way.
71  Using Arduino / Project Guidance / Re: Automated blinds - Sketch runs on Uno, but not on Standalone project... on: May 28, 2014, 01:09:59 pm
Post links to the libraries you're using.
72  Using Arduino / Project Guidance / Re: Looking for advice for motion control project on: May 28, 2014, 05:36:23 am
It may help if you tell us what hardware you're using (provide links to it, or better to the datasheet of it).

Also post the sketch you're testing with and the output you get for the various holding positions. If possible, also provide the schematics of the circuit you're using for that.
73  Using Arduino / Project Guidance / Re: Automated blinds - Sketch runs on Uno, but not on Standalone project... on: May 28, 2014, 05:27:56 am
Can you post your circuit schematics? From the description I got the impression that the decoupling capacitor is missing (100nF from Vcc to GND directly at the corresponding ATmega pins).

Did you power your Arduino with just that 9V battery too while you used that for testing? It's possible that the battery isn't able to deliver enough current for that setup (there are no links to the used hardware).
74  Using Arduino / Networking, Protocols, and Devices / Re: I2C Communication mode between Arduino Ethernet and EVAL-ADAU1701MINIZ on: May 28, 2014, 05:20:34 am
No link to the used hardware! And in the post you linked to there is no circuit drawing. Please provide the circuit schematics in your post.
75  Using Arduino / Networking, Protocols, and Devices / Re: Arduino C++ comunication? on: May 28, 2014, 05:16:27 am
Quote
I know there is Serial, and I could do some pin programming to make my own data transfer.. but the arduino has an USB port, isn't it possible to use that for reliable communication? When I try with serial libraries my data won't really get sent back correctly over the network (using raspberry pi to fetch arduino serial data and send it as RAW over sockets).

Sure, it is possible to communicate from the Raspberry Pi with the Arduino over the USB connection. On the Arduino (most models) you can just use the Serial object to send or receive data from the Raspberry Pi.

Quote
Is there maybe a linux library for C++ to get reliable communication with the Arduino?

You can use any Linux serial library for that, just remember that opening the serial device will reset your Arduino in standard configurations.

Quote
How to manage the arduino buffers?

What do you want to manage? The buffers on the Arduino side are quite small, usually you don't have to care for them, if you have you might want to change your algorithms.

Quote
can I access data directly by memory address in the Arduino from outside (via usb, isp, etc)?

You can do that for the EEPROM but not at run time. What do you want to achieve? It seems you try to use experience from other platforms unchanged on the Arduino side but please explain what you want to do not how you want to do it.

Quote
I'm just wondering how to get reliable communication, because as of now 90% packets are corrupt. (and it's hard to debug whenether it's because the raspberry fetches the data wrong or my pc receives the data wrong etc, it's always one or the other which fails at some point)

What kind of packets are we talking about? TCP/IP? Show your sketch and the program you're using on the Raspberry Pi side.
Pages: 1 ... 3 4 [5] 6 7 ... 343