Recent Posts

Pages: [1] 2 3 ... 10
1
Project Guidance / Re: Onboard DC/DC Converter
Last post by Daz1712 - Today at 01:53 am
Did no one remember that each pin on the micro supplies 40mA MAX and really needs to run only 20mA for the sake of the micro.
Also recomended that the total power through the board beonly around 200mA.

Warnings

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

Power

The Arduino Uno board can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the GND and Vin pin headers of the POWER connector.

The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

Vin. The input voltage to the Arduino/Genuino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.GND. Ground pins.IOREF. This pin on the Arduino/Genuino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs to work with the 5V or 3.3V.

Hope this helps. Google Arduino Specifications for more.

Arduino pins should only be used to drive transistors, fets or other ICs.

Daz
2
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]// your code is here[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Select the port of your Arduino from the Tools > Port menu. If that menu is grayed out or the port of your Arduino board is not shown then one of the following may be the cause:
  • You may need to install the driver for the USB-serial chip on your Arduino. Determine which chip is used on your Arduino and install the driver.
  • You may be using a charge-only or defective USB cable. Test your cable on another device to confirm that it works for data.
3
Programming Questions / Re: hc12 and button input
Last post by Danksy - Today at 01:52 am
Many thanks for all of the replies and help. The placement of the brace was the problem. I will now further refine code as per suggestions. I do indeed want the solenoid and spark to stay activated when pressed, which is why i habe not bothered with bounce (rightly or wrongly).

Thanks again
Danksy
4
Project Guidance / Timer Sketch Example
Last post by UbuAnon - Today at 01:50 am
I am looking for a simple timer sketch. It should turn-on a relay at 45, 60, or 90 minutes, etc., by changing a variable in the code.
I am guessing that this can be done with millis (but I don't know how to write the sketch myself). I hope to upload the sketch and run two wires to the relay. I'm confident a simple program like it must have been done before.
I have been trying without success to make a countdown timer sketch work which involves a LCD display. It is a nice project, but, for my purpose, the LCD display is unnecessary.
Anyway, I can't get it to work. The problem seems to be with the button circuitry. That's what gave me the idea to eliminate the buttons and LCD, and simply write a variable for the desired time in the code.
A link to the LCD project is copied below. The relay I want to control is shown in the second link. Briefly, it operates at 3-48VDC input, which is perfect for use with an Uno board.

https://www.electronicshub.org/adjustable-timer/

https://www.sparkfun.com/products/14236
5
Microcontrollers / Re: Unable to upload sketches ...
Last post by pert - Today at 01:50 am
Please do this:
  • File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
  • Sketch > Upload Using Programmer
  • After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the toolbar).
6
I'm glad to hear it's working now. Enjoy!
Per
7
Programming Questions / Re: src subdirectory
Last post by pert - Today at 01:47 am
If your sketch is structured like this:

TEST2
|_TEST2.ino
|_src
   |_blah
      |_blah.h
      |_blah.cpp

Then the #include directive in TEST2.ino should look like this:
Code: [Select]
#include "src/blah/blah.h"

and the #include directive in blah.cpp should look like this:
Code: [Select]
#include "blah.h"

It doesn't matter what you have your sketchbook location set to, or whether the sketch is in the sketchbook.
8
Are you SURE you only want to look at the button when the alarm is sounding?!?  You will only be able to set the limit to a value lower than the current limit.

Code: [Select]
  if (flexSensorReading < 100) {
    Serial.println("Alarm! Set Angle Exceeded");
    digitalWrite(Piezo, HIGH);
    if (digitalRead(inPin)) {
      //    LoggedPosition=flexSensorReading;
    }
    delay(100);
    digitalWrite(Piezo, LOW);
  }



Look at the sketch I posted to see one way to correct this programming error.
9
Displays / Re: md_max72xx matrix type #de...
Last post by pert - Today at 01:43 am
Can anyone see a way to define this without having to change the MD_MAX72XX.h file
When you mention a 3rd party library on the forum it's helpful to add a link to where we can find that library (in this case https://github.com/MajicDesigns/MD_MAX72XX/blob/master/src/MD_MAX72xx.h). Note that I used the chain links icon in the toolbar to make the URL clickable. We shouldn't need to go on a search to find a library just to help you out. Sometimes there are even multiple libraries of the same name so we might get the wrong one and end up in a lot of confusion.

having to change the MD_MAX72XX.h file every time I want to compile for one matrix or to the other ?
Do you want to use the different configurations in the same sketch, or in two different sketches?

I guess this means it is not possible to use the 2 matrices in the same sketch, not that I need it now, I just noticed it.
I wonder if it was actually necessary to use the preprocessor for this purpose in the library? If the library was written so that you could configure it at runtime (e.g. mx.configure(USE_FC16_HW)) then you could switch between configurations as needed (at the expense of some overhead).
10
Board:arduino UNO
Servo:SG90
error:Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 5590 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 278 bytes (13%) of dynamic memory, leaving 1770 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified.


Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

code:/*NOTE: Four Servos of the Robotic Arm are connected to 4 PWM Pins of Arduino
and these 4 servos are named a, b, c and d.

If you want to control servo a, then type "90a/",
where "90" is the PWM value (range is 0 - 255),
"a" means servo a and "/" is string parse delimiter.

Some other examples: 100a/ or 120b/ or 40c/ or 25d/
*/

String readString;
int x=90, y=90, z=90, p=90;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod;

void setup()
{
  Serial.begin(9600);


  myservoa.attach(3);
  myservob.attach(5);
  myservoc.attach(6);
  myservod.attach(9);
  myservoa.write(x);
  myservob.write(y);
  myservoc.write(z);
  myservod.write(p);
}

void loop()
{
  if (Serial.available()) 
  {
    char m = Serial.read();
    if (m == '/')
    {
      if (readString.length() >1)
      {
        Serial.println(readString);

        int temp = readString.toInt();
       
          Serial.print("writing Angle: ");
          Serial.println(temp);
          if(readString.indexOf('a') >=0)
          {
            if (temp>x)
            {
              for (int i=x; i<temp; i++)
              {
                myservoa.write(i);
                delay(10);
              }
              x=temp;
            }
            else
            {
            for (int i=x; i>temp; i--)
              {
                myservoa.write(i);
                delay(30);
              }
            }
            x=temp;
         }
//////////////////////////////////////////////////////////////////////////////         
          if(readString.indexOf('b') >=0)
          {
            if (temp>y)
            {
              for (int i=y; i<temp; i++)
             { myservob.write(i);
              delay(10);
             }
              y=temp;
            }
            else
            {
            for (int i=y; i>temp; i--)
             {
              myservob.write(i);
              delay(10);
             }
              y=temp;
          }
         }
///////////////////////////////////////////////////////////////////////
          if(readString.indexOf('c') >=0) //myservoc.write(n);
          {
            if (temp>z)
            {
              for (int i=z; i<temp; i++)
              {myservoc.write(i);
              delay(10);}
              z=temp;
            }
            else
            {
            for (int i=z; i>temp; i--)
             {
              myservoc.write(i);
              delay(10);
              }
              z=temp;
            }
         }
/////////////////////////////////////////////////////
         if(readString.indexOf('d') >=0)
          {
            if (temp>p)
            {
              for (int i=p; i<temp; i++)
              {
                myservod.write(i);
                delay(10);
              }
              p=temp;
            }
            else
            {
            for (int i=p; i>temp; i--)
              {
                myservod.write(i);
                delay(30);
              }
            }
            p=temp;
         }

       readString="";
      }
    } 
    else
    {     
      readString += m;
    }
  }
}
Pages: [1] 2 3 ... 10