Recent Posts

Pages: [1] 2 3 ... 10
1
Hi guys,


I'm trying to achieve a serial communication between 2 Arduino Nano (v3 - with micro-usb), over the USB connectors (micro-usb to micro-usb).

I've tested the code of both Arduinos, individually, with the Serial Monitor on the OS X. All good.
It seems Arduino - OS X via micro-usb works, but not the Arduino - Arduino.

I'm basically trying to send a char from one arduino and receive it on the other, using a micro-usb cable.
Found nothing online, I'm starting to think this might not be possible, which doesn't quite make sense.


Please let me know your thoughts  :'(


Transmitter Arduino code:
Quote
int ledPin = LED_BUILTIN;

void setup() {
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  Serial.begin(115200);
}

void loop() {
  if (Serial.available()) {
    char received = (char)usbSerial.read();
    Serial.print(received);

    if (received == 'a') {
      digitalWrite(ledPin, HIGH);
    } else if (received == 'x') {
      digitalWrite(ledPin, LOW);
    }

    delay(1000);
  }

}
Receiver Arduino code:
Quote
int ledPin               = LED_BUILTIN;
int buttonPin          = 4;
char commandSent = '-';

void setup() {

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  pinMode(buttonPin, INPUT);
  digitalWrite(buttonPin, LOW);
 
  Serial.begin(115200);
}

void loop() {
    if (digitalRead(buttonPin) == HIGH && commandSent != 'a') {
        digitalWrite(ledPin, HIGH);
        Serial.print('a');
        Serial.write('a');
        usbSerial.print('a');
        commandSent = 'a';
     }
     if (digitalRead(buttonPin) == LOW && commandSent != 'x') {
        digitalWrite(ledPin, LOW);
        Serial.print('x');
        Serial.write('x');
        usbSerial.print('x');
        commandSent = 'x';
    }

    delay(10);
}
Thank you very much,
Marius
2
I am building small workshop in my basement. This workshop will need a dust extraction system and i want to make a semi automatic system. I first designed one system with relays, but it became very large with the functions i want. I realized that i could reduce the hardware complexity by using arduino and i have sketched up a system.

The only thing stopping me from doing this is my complete lack of programming skills and knowledge.
I can copy and modify programs from the internet to a degree but this is way above my skill.


This is what i have so far:


P&ID Dust Collection

Schematic Dust extraction

Layout for control panel


I have tested the connections and everything seems to work (i use LEDs instead of relays for the test) and the inductive sensor seems to fit the gate, and work fine on 5V even though it is rated for 10-32V



I have written a function description of what i want

S1 Momentary switch NO
S2 Momentary switch NO
B1..5 Inductive sensor NO
H1 Lamp
H2 Lamp
K1 Relay
K2 Relay


Manual Override (yellow button)

S1 is pressed and starts manual override, dust extracting starts and lamp H1 lights up (D05, D07, D08 = High) S1 is pressed again and stops manual override, dust extract stops and lamp H1 is turned off (D05, D07, D08 = low) Under Manual Driving, the system may not be set to Auto


Auto Mode (white button)

 S2 is pressed to start auto mode, lamp H2 lights up to indicate auto mode is active (D06 = High). The signal from the inductive sensor is high when all dust ports are closed and the system is in standby (DO4 = High)

Manual override overrides Auto Run, if auto mode is selected, lamp H2 will turn off (D06 = low) during manual override; the system will return to auto mode when manual override ends if the system was in auto before manual driving started.

In auto mode the dust extraction starts when signal from external inductive meter goes low (D04 = low) When running the dust extraction in auto mode lamps H1 and H2 both are lit (D05, D06, D07, D08 = High)

Power-up booting all modes off, so the dust extraction dont start in case of power loss.



Where should i begin? How is a program like this written in an elegant matter? what kind of functions is most suitabe to define the states? this is so far beyond copying a Led blink program and changing the in and output pins i dont even know where to start.

3
Français / Re: Pins envoient moins que 5v
Last post by kreys83 - Today at 10:36 pm
Mais j'en sais rien c'est juste une led qui s'allume quand le relais est activé. Cest un module tout fait.
Et on s'en fout, quel que soit le composant branché en sortie j'observe qu'il recoit pas assez de courant.
Je suis pas un as de l'electronique, je branche les trucs en faisant en sorte que ca marche. Parfois ca crame et je recommence. Japprend comme ca.
Si c'est pour etre autant désagréable vous pouvez aller ailleurs.
Ma led est branchée sur un pin numérique, puis côté moins sur unz résistance de je sais pas combien. Le fait est que quand je branche directement la led sur le 5v plutot que sur une pin controlable ca marche, donc ca vient pas de la résistance.
4
Project Guidance / Re: watering system
Last post by aguirreeng - Today at 10:35 pm
What value cap did you try?

You should have a 0.1uF bypass cap near the power pins of the ATtiny85. Your pull-up resistor on the ATtiny85 reset pin is too high. Use 10K (brown-black-orange) not 1M (brown-black-green). Same for your other button, but you can remove that and connect the button between the pin and ground and use INPUT_PULLUP.
Thank you @PaulRB, I've tried the capacitor with between ATTiny pins 4 and 8 (GND and 5V) with a big one I had here (470uF). Was that too high? I'll try to change the pull-up resistors.

Cheers!
5
Software / Re: Problemas con arduino mega
Last post by Rober1788 - Today at 10:33 pm
me puedes decir el nombre para buscarla para probar
6
Project Guidance / Re: pneumatic small scale fact...
Last post by MorganS - Today at 10:31 pm
There are no built-in events like "onStartButtonPressed". You have to detect the events yourself by reading the digital inputs directly.

Also see: Planning and Implementing an Arduino Program
7
Software / Re: Problemas con arduino mega
Last post by Esfinterman - Today at 10:28 pm
Hola. El ETS necesita una aplicación de desarrollo para mandar y recibir datos por un puerto serie, aplicación que se descarga de la Wiki de SCS Software. Imagino que lo habrás instalado, no? Recuerda que esta aplicación necesita saber qué puerto quieres usar. También, ten en cuenta que el ETS se suele actualizar cada dos semanas o un mes, y es posible que lo que te funcionase antes hoy cause conflicto con algo. ;)
8
Thanks very much, Morgan.

As you can see from the pseudocode, I have an idea for how much of the code should go, but there are 2 main areas I believe I'll have problems with.

1) Most efficient syntax for the series of IF statements.
2) How to implement Arduino's average library.
9
Software / Re: Problemas con arduino mega
Last post by Rober1788 - Today at 10:27 pm
no se si sera pero en dispositivos e impresoras aparece como no especificado y si lo doy a solucionar problemas sale esto: https://mega.nz/fm/2EVlxAaC y esta conectado a un usb normal, tambien en administrador de dispositivos y informacion sale que requiere mas instalación le e dado a actualizar controladores pero nada aqui la otra imagen: https://mega.nz/fm/2EVlxAaC
10
Thanks for your commen!

I was hoping I could rule out issues with the serial communication as such due to the fact that it works perfectly with the buffer.

Regarding your comment with the write within the interrupt, it made me thinking whether it could still be TinyGPS that causes the issues here, and voilà! Removing the encoding from the interrupt got rid of the garbled messages.
Now I need to find a solution for this..maybe collecting data in an array and only calling the encoding every once in a while, while detaching the interrupt temporarily and afterwards checking whether anything is in the buffer?
Pages: [1] 2 3 ... 10