Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Project Guidance / Re: Measure distance water
Last post by bluejets - Today at 10:27 am
Are you aware of the external circuit it needs? You can't read the output of this sensor directly, it's a Wheatstone bridge. The HX711 appears to be a good choice to amplify the signal.

The output of the sensor I mentioned can be used directly, just add a few decoupling caps.
No, not really my concern.
I simply posted an alternative.
22
Quote
You want to turn on an LED for a period of 1uS! Why is that and what will it do for you?
To reduce the current consumption.



Quote
There isn't one. The form factor has changed, all the fast boards are Uno shaped or smaller and they all run off 3V3 and not 5V.

So you will have to do some mechanical adaptation and logic level shifting to get anything to drive one these days.
Do you have any example of some mechanical adaptation and logice level shifting to drive. Please share. it will be helpful for me to do it.

Regards,
V. Prakash
23
General Electronics / Re: LoRa and ams1117 3.3v
Last post by groundFungus - Today at 10:26 am
I use the same regulator for several ESP8266 and NRF24 projects and have never seen such behavior.  Both of those pull quite a bit of current (relatively).  How much current does the LoRa module need?  Does the ams1117 have the required caps on the input and output?
24
General Electronics / ds3234 rtc breakout rework for...
Last post by guy_c - Today at 10:25 am
Please look at the pics / drawings and you're welcome to ask clarifications here
25
Français / Re: aide programmation fin de ...
Last post by patrick-papy - Today at 10:24 am
 pour le vertical OK tout correspond

pour horizontal, joystick vers l'Est il me dit qu'il va de l'Est vers L'Ouest, donc inversé idem FDC inversé également

et donc dans l'autre sens c'est le contraire.
26
Hello guys,

I use a reed sensor to get speed on bicycle, this speed is sending from Arduino Mega via HC 05 to Arduino Uno via next HC 05 as master slave. Pairing is done well because Arduinos can change the information but Arduino slave reads wrong these information.

I want slave Arduino will control the pwm pin according to the speed that receives. Faster speed = 100% pwm, low or no speed = 0% pwm.

Current function: Arduino gets random values, sometime pwm is 100%, sometime 0%. I don't know why. Can you help me please? Thank you very much. Scheme is attached.

I would also need to reset the pwm if the value of speed is for example 3 seconds the same... But it also does not work...

Master

float start, finished;
float elapsed, time;
float circMetric=2.093; // wheel circumference (in meters)
float circImperial; // using 1 kilometer = 0.621371192 miles
int speedk, speedm;

float AuraPWM;


void setup() {
Serial.begin(9600);
circImperial=circMetric*.62137;

attachInterrupt(digitalPinToInterrupt(2), speedCalc, RISING);

start=millis();
}


void speedCalc()
{
//Function called by the interrupt

if((millis()-start)>100) // 100 millisec debounce
{
//calculate elapsed
elapsed=millis()-start;

//reset start
start=millis();

//calculate speed in km/h
speedk=(3600*circMetric)/elapsed;

//calculate speed in mph
speedm=(3600*circImperial)/elapsed;
}
}




void loop() {
Serial.println(speedk);
Serial.write(speedk);
delay(100);

AuraPWM = speedk;


}

------------------------------------------------------------------------------

Slave
#define Aura 3
int state = 0; // Vyctena hodnota z bluetooth
int OldState = 0;
int8_t AuraPWM = 0;
long unsigned OldMillis = 0;
long unsigned OldMillis2 = 0;
void setup() {
pinMode(Aura, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (millis() - OldMillis > 500) {
OldMillis = millis();
if (state - OldState == 0) {
state = 0;
}
OldState = state;
}
if (Serial.available() > 0)
{
state = Serial.read();
AuraPWM = state * 10;
if (state != OldState) {
OldMillis = millis();
OldState = state;
}
}
if (millis() - OldMillis2 > 1000) {
OldMillis2 = millis();
Serial.println(state);
analogWrite(Aura, state);
}
}

27
The code you sent works....And plus i learnt the importance of functions...

Bundle Of Thanks....

28
I want to send data (G-code) from a Java program on my PC to an Arduino. The communication between the Arduino and my PC works fine because I can send data in in both directions.
If I test the parsing code of my Arduino with the serial monitor of the Arduino I works fine.
If I do the same thing with my Java program, it's not working. In my Java program I receive the data I send to the Arduino but I'm not receiving any parsed data. The problem is, that this is hard to debug because I can't open the serial monitor of the Arduino when I'm communicating with my Java program.

Below you can find my programs:

Arduino:
Code: [Select]

#include <Arduino.h>

char ch;
const int NUMBER_OF_FIELDS = 6;
int fieldIndex = 0;
double values[NUMBER_OF_FIELDS];
int decimalPoint[NUMBER_OF_FIELDS];

void setup()
{
  Serial.begin(9600);
  Serial.println("setup");
  delay(250);
}

void loop()
{
  // G/M position 0 (code)
  // X position 1
  // Y position 2
  // Z position 3
  // F feedrate
  // E length of filament to consume
  // a typical array looks like this:
  // [G/M, X, Y, Z, F, E]

  if (Serial.available() > 0)
  {
      ch = Serial.read();
      delay(250);
      Serial.println(ch);
      delay(250);
     
      if (ch == 'G' || ch == 'M') {
        fieldIndex = 0;
      } else if (ch == 'X') {
        fieldIndex = 1;
      } else if (ch == 'Y') {
        fieldIndex = 2;
      } else if (ch == 'Z') {
        fieldIndex = 3;
      } else if (ch == 'F') {
        fieldIndex = 4;
      } else if (ch == 'E') {
        fieldIndex = 5;
      } else if (ch >= '0' && ch <='9') {
        values[fieldIndex] = values[fieldIndex] * 10 + (ch - '0');
        if (decimalPoint[fieldIndex] > 0) decimalPoint[fieldIndex] *= 10;
      } else if (ch == '.') {
        decimalPoint[fieldIndex]++;
      } else if (ch == ' ') {
        if(fieldIndex < NUMBER_OF_FIELDS -1);
        fieldIndex++;
      } else {
        delay(250);
        Serial.print(fieldIndex + 1);
        delay(250);
        Serial.println(" field received");
        delay(250);

        for (int i = 0; i <= fieldIndex; i++) {
          if (decimalPoint[i] > 0) {
            Serial.println(values[i] / decimalPoint[i]);
            delay(250);
          } else {
            Serial.println(values[i]);
            delay(250);
          }
          values[i] = 0;
          decimalPoint[i] = 0;
        }
        fieldIndex = 0;
      }
     

   
  }

 
}



Java
Code: [Select]

package communicationArduino;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintWriter;
import java.util.Scanner;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.fazecast.jSerialComm.SerialPort;

public class Main {

static SerialPort chosenPort;
static int x = 0;

public static void main(String[] args) {

// create and configure the window
JFrame window = new JFrame();
window.setTitle("Sensor Graph GUI");
window.setSize(600, 400);
window.setLayout(new BorderLayout());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// create a drop-down box and connect button, then place them at the top of the window
JComboBox<String> portList = new JComboBox<String>();
JButton connectButton = new JButton("Connect");
JPanel topPanel = new JPanel();
topPanel.add(portList);
topPanel.add(connectButton);
window.add(topPanel, BorderLayout.NORTH);

// populate the drop-down box
SerialPort[] portNames = SerialPort.getCommPorts();
for(int i = 0; i < portNames.length; i++)
portList.addItem(portNames[i].getSystemPortName());


// configure the connect button and use another thread to listen for data
connectButton.addActionListener(new ActionListener(){
@Override public void actionPerformed(ActionEvent arg0) {
if(connectButton.getText().equals("Connect")) {
// attempt to connect to the serial port
chosenPort = SerialPort.getCommPort(portList.getSelectedItem().toString());
chosenPort.setComPortTimeouts(SerialPort.TIMEOUT_SCANNER, 0, 0);
if(chosenPort.openPort()) {
connectButton.setText("Disconnect");
portList.setEnabled(false);
}

// create a new thread that listens for incoming text and populates the graph
Thread thread = new Thread(){
@Override public void run() {
System.out.println("connected read");
Scanner scanner = new Scanner(chosenPort.getInputStream());

while(scanner.hasNextLine()) {
try {
String line = scanner.nextLine();
System.out.println(line);
window.repaint();
} catch(Exception e) {}
}
scanner.close();
}
};
thread.start();


// create a new thread that listens for incoming text and populates the graph
Thread thread2 = new Thread(){
@Override public void run() {
System.out.println("connected write");
Scanner scan = new Scanner(System.in);
String input = "";
PrintWriter output = new PrintWriter(chosenPort.getOutputStream());
while (true) {
input = scan.nextLine();
output.print(input);
output.flush();
}
// output.close();
}
};
thread2.start();


} else {
// disconnect from the serial port
chosenPort.closePort();
portList.setEnabled(true);
connectButton.setText("Connect");
x = 0;
}
}
});

// show the window
window.setVisible(true);
}

}



29
Hello, I've made my simplified board based on Nano. I took ATmega328p (smd) from chinese bought nano, it has bootloader, but it doesnt upload code (it used to upload on that nano board).

The error i get:
avrdude: stk500_getsync(): not in sync: resp=0x00

Attaching schematics, maybe I made a mistake there?
30
Hallo everybody,

i would like to compile my sketch in the arduino IDE. Till yesterday the sketch still worked. But now i cannot compile my sketch. I haven't changed anything in the program.

I have copy the url:"http://arduino.esp8266.com/stable/package_esp8266com_index.json" in the presets.

This is my board: NodeMcu 12E


A picture ist in the attachment

please can you help me

Thank you
Pages: 1 2 [3] 4 5 ... 10