Recent Posts

Pages: 1 ... 8 9 [10]
General Electronics / Re: Soldering iron tip black a...
Last post by Wawa - Today at 03:06 am
NEVER use sandpaper on coated tips.
Just tin the tip with normal resin-cored solder, and clean on a damp solder sponge or goldilocks (SS wool).
Repeat several times as needed.

Prevent by setting the right temp, and never use the tip to melt plastics.
First of all, we are not allowed to use the arduino.h library for this project, and I have been messing around with it for hours. I am using the VL53L0X sensor to set up two leds, one will be on when the reading is >400mm and then the other will be on when it is less than 400mm. I tried using the int main() and then placing the setup() function in that, and then using a while(1) { //place all of the loop code here} but it does not work at all. Below is my code, can anyone point me in the right direction. We are also not aloud to use the wire library and we have to use the specific TWI registers for the Mega 2560 but that is another problem I will figure out later.

Below is my code: the setup() function is at the bottom of the VL53L0X.cpp file and the initLED() is just initializing the LED's by assigning the appropriate pins as outputs. I can use Arduino.h and comment out the serial.begin(9600) and the print statement and it will still work fine, I just can't figure out how to use int main instead of the loop. Thanks for anyones help.
Hello Guys,

I need your help a little bit. I have been reading a lot in the recent weeks about non-blocking codes and other stuff to understand how to build up my code. But, I am still struggling.

I am trying to move a stepper motor and read a load cell simultaneously. The idea is to move the stepper motor continuously until I interrupt the action through the serial connection. I do not need very quick acquisition rate, 10 Hz is more than enough. So, the load cell's circuit (HX711) is not the issue.

My issue is probably is that I am sending data through the terminal "frequently". Here is the loop():

Code: [Select]

void loop(){
if (Serial.available() > 0) {

char cin =; //read in the command letter

  if(cin == 's'){ //if the command is 's' = START
     cin1 = Serial.parseFloat(); //value for speed from the terminal

  while ( != 'n') { //while we dont STOP through the serial this loop will run.
      if (micros() > time_now1 + cin1)
        counter++; //counter for the steps
        divider = 1000000/(cin1*counter); //the divider will tell the number of samples per second. more samples will slow down the arduino.

        time_now1 = micros();
        if (divider == 1) //div = 4, 4 samples / second. this is still OK for serial and stepper.
         if(scale.is_ready() == true){
         dataAdc =;}

          counter = 0;

        digitalWrite(stepper, HIGH);
      if (micros() > time_now2 + cin1) {
        time_now2 = micros();

        digitalWrite(stepper, LOW);

    }//end of WHILE 'n' loop
  }//end of IF 's' loop

So, as you can see, the Arduino is waiting for a command, a letter (s) through the terminal, and an integer to start the inner while loop. Then, while an other (n) letter is not coming through the terminal, the stepper motor (driven by and EasyDriver) is running based on cin1 which is basically the delay between a digitalWrite. During the run of the motor, I want to get periodic readouts from the HX711 circuit, for example at every 5000th cycle. I made a "divider" where I manually calculated my desired values and I check if I get that value. In this case, I have a "magic number", 1000000, so, when the speed (cin1) is at 200, I will get a readout at every 5000th step of the motor which is 1 value/second. . Based on this number, I can tell the program to enter a small sub-loop to send some data to my PC through the serial.

The problem comes here. When I send something through serial while the motor is running, there will be a small, periodic "knocking" noise coming from the motor. Since my delay (cin1) is in us, and the 4 serial.print takes roughly 1200 us, I suspect that the motor skips or stops for a short time, so the normal rhythm of the rotation gets interrupted for a very short time which will cause the noise.

I think this can be problematic, because if I run the the motor for a long time, I might have some problems with my accuracy due to the accumulated delays caused by the printing.

I tried to print on the second part of the stepping, to make the delays symmetric, but the problem is the order of magnitude time difference between the delays for the motor and the delay caused by the serial communication. I commented out the serial.print() part and ran the motor just as it is, without sending anything through the terminal, and there was no noise. I also tried to send some random characters, but NOT reading the hx711, and the noise was still there. So I suspect that the serial somehow blocks my motor.

I need to run this motor relatively fast, thus the microsecond region for delay is unavoidable. (I am using the stepper motor with a 1:100 gear setup, because I need torque, a lot.)

Is there anything that can be improved with my code (of course yes) and make the serial communication more efficient? I don't need very high speeds, 10 Hz is enough, but at slower speeds of the motor, even 1-2 Hz is OK.

Thank you for your help, and please let me know if you want me to provide more details.
Sensors / Re: Where do you connect the s...
Last post by Paul_KD7HB - Today at 03:01 am
Hello, I have one encoder connected to 5V, GND, Dig#2 and Dig#3. Can I connect the second  encoder to 5V, GND, Dig#4, Dig#5, and the third  encoder to 5V, GND, Dig#6, Dig#7, and the fourth  encoder to 5V, GND, Dig#8, Dig#9?
Will the Arduino Leonardo have enough current to power all four, or do I need 4 separate Arduino Leo boards with one encoder per board?
What encoders? Most encoders use a LED and a transistor to operate. Can you light 4 LEDs with your Arduino board? Of course you can. But without knowing what you are referring to, there could be all kinds of problems.

Have you carefully set the current limit to 1 Ampere/phase, the maximum current that the A4988 driver can handle?

AA batteries are a problem. Alkaline AA cannot supply 2A peak without a severe voltage drop, as required by that setting. Try using a sensible power supply, capable of at least 2A.

The voltage of the motor power supply has to be greater than 8V, and can go up to about 35V. But higher voltages will only improve the motor response time and maximum step rate, not the torque.
Posting the same question twice in the same forum serves no purpose. But will irritate people who might help.

Now, if the fan is flowing hot air onto an already hot circuit board, how will that help. How hot is a hot environment? Numbers really do matter.

Project Guidance / Need 8 temp sensors, battery m...
Last post by matt4x4 - Today at 02:56 am
I am new to Arduino but I was wondering if it is easily possible to have 8 temperatures reading the inside of my battery pack and displayed on an LCD screen. I also need it to display current volts/amps/Ah and Wh, all displayed, all the time.

Is this doable or do I need to go to a Raspberry Pi?

If it is doable, what Arduino do I need to use?

Thank You
Forget the sandpaper or anything similar, there are products that do not destroy the plating on an oxidized tip. These are used on a cold, not hot, tip.

Clean, heat and coat with solder or dip in tip tinner.

Hi Harrzack, did you ever get those synchro indicators to work?

I am trying to do the same with wind instruments are our aviation museum in New Zealand

Best regards
General Electronics / Re: selecting MOSFET for buck ...
Last post by adyah - Today at 02:48 am
Sorry for the inconvenience! I have attached my complete schematic. I just wanted to know if i could use the same mosfet used in this schematic for my ratings as well or not.
Pages: 1 ... 8 9 [10]