Skip to main content
4 votes

Arduino as analog to digital converter for temperature sensor

Both the ESP8266 and the Arduino have UART serial interfaces. This is by far the simplest method of communicating between two boards. Connect the TX of the Arduino, through a voltage divider to drop ...
Majenko's user avatar
  • 105k
4 votes

How to convert digital signal to analog value

The problem seems to be clear to you: for slow systems a pwm signal can be considered analog, but measuring at higher rates and without a filter reveales the digital nature behind pwm and all you see ...
Sim Son's user avatar
  • 1,869
3 votes

Dealing with a Signal Source

There's an easy way to achieve reading multiple pushbuttons using single analog input. All you need to do is create some voltage dividers at different voltages which can be read using analogRead. The ...
Siddharth Kothari's user avatar
3 votes

Digital to Analog converter with DAC5311, Any suggestion?

Classical +/- 1 problem If you do this calculation by hand uint16_t temp = int(voltage * pow(2, 8) / max_VOLT); you will get temp=256 and this is a value you can not convert with a 8 bit DAC. Try ...
theSealion's user avatar
3 votes
Accepted

SPI Connections to DAC

I'd like to output something simple like a digital AC voltage to the DAC and have it convert it, but as I understand it from here, I am just using the digitalWritecommand which is basically binary. ...
Majenko's user avatar
  • 105k
3 votes

Analog pins for 4x4 matrix keypad

You can use the analog pins. I prefer {A0, A1, A2, A3} in the code instead of {14, 15, 16, 17}. That makes it easier to check if you connected the wires to the right pins. Don't use pin 13 for an ...
Jot's user avatar
  • 3,246
2 votes
Accepted

Producing a sine wave with the DAC?

First, I have to say I am not familiar with the Zero hardware, so I am answering in quite general terms. Hopefully you will also get some answers with hardware-specific information. That being said, ...
Edgar Bonet's user avatar
  • 43.3k
2 votes
Accepted

Trouble reading analog (PWM)

Seeing all on for 128+ and all off for 127- is indicative that you are using a pin that can't do PWM. If you use a non-PWM pin with analogWrite it goes "Is this less than 128? Yes? Then I will turn ...
Majenko's user avatar
  • 105k
2 votes
Accepted

Output frequency from an SPI DAC (MCP4922) is lower than expected

Let's do some maths... 16MHz master clock / 2 = 8MHz SPI clock 2 transactions = 16 bits (not 12!) 8,000,000 / 16 = 500,000 2 transitions per cycle 2 channels 2 + 2 = 4 500,000 / 4 = 125,000Hz So in ...
Majenko's user avatar
  • 105k
2 votes

Issue with incrementing PWM over time

float pwmDelta=((255/100)*(highLim-lowLim))/(tLim); That line should be: float pwmDelta=((255.0/100)*(highLim-lowLim))/(tLim); Adding the .0 tells the compiler to do that math using floats and you ...
Delta_G's user avatar
  • 3,370
2 votes
Accepted

Controlling op amps amplification ratio by arduino

The basic principle is easy to implement. A non-inverting configuration has a resistor Ri from the inverting input to ground, and a feedback resistor Rf from the same input to the output. The signal ...
Boggyman's user avatar
  • 609
2 votes
Accepted

Mildly accurate oscilloscope using Arduino Uno R3

I want my reference voltatge to be 1.1v so that by dividing it to 1023 parts I will have the accuracy of about 1mv. You will have a resolution of about 1 mV. The accuracy will be significantly worse ...
Edgar Bonet's user avatar
  • 43.3k
2 votes
Accepted

Reading constant battery voltage and using the obtained value in sensor formula

If you set the Vref with the internal reference of 1.1v, then the voltage presented at analog pin A1 is simply as: const float Vref = 1.1; // according to datasheet there is a +/-10% variance, need ...
hcheung's user avatar
  • 1,416
2 votes

RMS Voltage Value

There are multiple issues with this piece of code: Local variables, i.e. variables defined inside functions or braced blocks, are created each time the execution enters the function or block, and ...
Edgar Bonet's user avatar
  • 43.3k
1 vote
Accepted

Dealing with a Signal Source

After a day or two of working on this problem, I have found that it is best to avoid using the analog pins and stay away from directly interfacing with the 555 Timer. This is a simplified version of a ...
David Wisniewski's user avatar
1 vote

How to turn the digital pin to analog pin?

You can use an external A/D converter, there are a lot of varieties in a lot of price ranges for the Arduino. Check your favorite online source. That will require two of your existing analog pins for ...
Gil's user avatar
  • 1,843
1 vote
Accepted

Vary the Speed of Motor

The sawtooth pattern you're showing looks like what I would expect from incomplete filtering of the PWM signal from the Arduino. I don't know if the variation is going to affect your motor ...
Duncan C's user avatar
  • 5,702
1 vote

Distorted audio from mcp3002

From the code you linked to, it appears the SPI port is completely controlled by the software: void loop() { ... msb = SPI.transfer(cmd); lsb = SPI.transfer(0); ... } This means that ...
Edgar Bonet's user avatar
  • 43.3k
1 vote
Accepted

Creating and Arduino synthesizer without the tone library

You just have to add the waveforms. For example, if you want to play pure tones (the simplest and most boring timbre), you generate a sine wave for each of them and add them together: struct Note { ...
Edgar Bonet's user avatar
  • 43.3k
1 vote

How can I scan for a HIGH signal on digitalRead during the main loop, while running other things?

Simplify, and show your setup code. First, do you have a pinMode call in your setup function: void setup() { pinMode(A15, INPUT_PULLUP); Serial.begin(115200); } Then use test code like this: ...
Duncan C's user avatar
  • 5,702
1 vote

How to Read Voltage Level?

First off you need to convert your signal's units from analog -> voltage. Do this by using the following equation. I've modified your code so you can copy and paste it into your IDE. float volts = ...
L. Paw 's user avatar
  • 131
1 vote
Accepted

Attaching Microcontroller to DAC evaluation board

Your DAC uses the SPI protocol. For that you want to connect it to the SPI header. That's the 6-pin (3x2) header numbered 11 on the uC32. Connect: The uC32's SCK pin to the DAC's SCLK The uC32's ...
Majenko's user avatar
  • 105k
1 vote

Stacking adc's when making an midi controller ( lots of potmeters)

These ADC's use the SPI protocol. Luckily the Arduino has one onboard. With each ADC you get 8 channels (thus inputs). Since you need more than one SPI device (ADC in your case). With SPI you can ...
Michel Keijzers's user avatar
1 vote

Using an esp8266, how can I create a circuit to measure 2 different analog inputs (not simultaneously) with only one ADC pin available (A0)

There's two basic solutions, both of which require the addition of an external chip: Use an analog multiplexer to select the different devices to connect to the ADC input Use an external (I2C or SPI) ...
Majenko's user avatar
  • 105k
1 vote

Arduino Uno Digital to Analog Converter

Try commenting out the serial in your sketch. In my experience serial communication takes time, and I assume you have a short window where the voltage peaks at more than a volt. Or initialize the ...
Andrei Dragan's user avatar
1 vote

It seems as if there is a 220K pull-down resistor on analog pin 0

They don't connect a resistor as such, but analog input pins do have an impedance which can affect your readings. If your output impedance (the resistance of your resistors) is within about a tenth ...
Majenko's user avatar
  • 105k
1 vote

Use photocell as digital input

I see two possible options for achieving what you want: Voltage divider This is the solution proposed by William Roy: you make a voltage divider circuit and check whether it gives a voltage above the ...
Edgar Bonet's user avatar
  • 43.3k
1 vote

Use photocell as digital input

Yes, you can use LDRs(photocells) as an indirect digital input. You can design a voltage divider circuit, which incorporates your LDR and gives LOW or HIGH digital readings based on your pre-...
William Roy's user avatar
1 vote

Trying to read analog signal with digital pin using outside ADC

The MCP3008 is an SPI device. You connect it to the SPI pins of your Arduino. Then you can read 8 analog channels through it. It requires 4 pins: MISO, MOSI, SCK and a chip select pin.
Majenko's user avatar
  • 105k

Only top scored, non community-wiki answers of a minimum length are eligible