[Solved] Arduino-controlled power supply?

Hello guys, I was working on a project that supplies varying voltages on an 433Mhz RF module, to experiment how supply voltages specifically effect signal range.

Q : Is there an IC/module/circuit that allows me to apply stable, variable, and digitally controlled voltage?

My requirements are as following:

  1. Apply varying voltage to the common cheap 433mhz rf module, varying from 0~12V(0~5V is acceptable, though not ideal. Higher the max, the better.)
  2. Does not effect the arduino's performance too much, since it has many other things to run.(analogWrite+low pass filter seems to mess up I2C communication and millis(), probably because it messes up the clock. Tell me if I am wrong about this)
  3. Should provide fairly stable voltage, if it is a PWM in the first place, it's okay because I can just hook it up to a low pass filter.
  4. Equal to or above 8bit resolution.
  5. Ideally be a neat single package(IC, single pcb package)

What I tried:

  1. analogWrite() Ă— low pass filter
    It seems to mess up my I2C and millis()
  2. Adafruit digital potentiometer(DS 1841)
    Voltage drops to about 2.1V when I apply any change to voltage.
  3. MCP4131
    Same as 2, if you know a solution to this please tell me.
  4. DAC0800lcn
    As soon as I bought this, I realized my ability to get information purely from datasheet is VERY poor, there wasn't any examples using this with arduino, thus none in the way I intend to.

What I will try to do:
If everything fails I will connect 8bit R2R to a shift register, to be controlled by the arduino.
But this will prevent me from going for higher resolution or higher voltage than 5V 8bit(I wasn't able to find R2R with higher resolution, and raising 5v logic from digital pins to 9~12V will require excess hardware and space)

I kept wandering the internet for like, a month solely to answer this question. Maybe I was searching on the wrong keywords?(digipot / DAC)

What I know:
I'm not new to arduino, it's been a few years since I used it, but I am a student in programming, so my low-level knowledge on other ICs or electronics in general isn't that professional.

Any kind of answer will be helpful, even a 'no there is none', or 'do your research first'

If your answer is the latter, please take your time to mention what keyword I should search on.

DAC's, Pot's and R2R are only good for signals because they cannot maintain their voltage under load.

In fact what your describing is a standard electronics tool.
A Programmable Power Supply

For a single chip solution look for a "Adj. Voltage Regulator IC"
such as the LM317

1 Like

If this just fit an experiment , it would easier just to buy a variable power supply ., which I’m sure would be a good investment anyway .

If this is a RFM69 the data sheet shows it to provide full transmitter power from 2.6 to 3.6 volts .

2 Likes

So I WAS searching for the wrong keywords, thank you.
So in case of lm317, perhaps I can adjust the resistor values using digipot to create the desired effects?

First of all, thanks for your reply.
Yeah, I do understand but unfortunately the project is supposed to be portable.
A voltage regulator is one of the bigger equipment I will buy, but for now, I can't use it.

But your problem may well then be that the power supply you have built Is “unknown” and adds another variable ( eg noise , peak power etc).

Why would you want to do this? - a voltage outside of the specification is something you don’t want to do - it may change device to device and you may get other issues such as transmission errors etc . If you design stuff , you work within the manufacturers spec - if it was ok at a different voltage , they would say so

1 Like

The chip I'm using is something of superhet type, kinda different from the more common ones but very similar in design

Manufacturer states the following:
Transmitter(3-12V),Receiver(3.3-5V)

I also understand there will be errors. Not only the voltage, but also RF itself is something extremely unpredictable, I knew it from the start of the project. But there's many other uses I have for this, so I'm doing it anyway

Do your research :wink: but I believe that they will not work due to voltage limitation's as they will be subject to the output voltage.

Typically PWM thru a Low Pass filter and a op amp is the most often used solution.

1 Like

Thank you, you corrected me from a totally wrong course. I was doing so, and found 2 solutions.

  1. Pwm+low pass to adjust pin
  2. OpAmp+Digipot, to use the digipot as a voltage divider(?) and not connect it straight up to the adj pin, because it will cause the problem you just mentioned.

Thank you again, Hutkikz, really, I will work and post reply containing my final solution for anyone who just might need the same answer as I did.

1 Like

Final Solution:

  1. Circuit :

    Diagram may be a bit messy, but it's basically the same thing as
    the answer stated in this link.
    Parts used(L->R): MCP41010, LM358, LM317, TL431, 2N3904
  2. Code :
#include <SPI.h>

#define DATA  11
#define CLK   13
#define CS_DIGIPOT 10

void write_digipot(int val) {
  digitalWrite(CS_DIGIPOT,LOW);
  SPI.transfer(B00010001);
  SPI.transfer(val);
  digitalWrite(CS_DIGIPOT,HIGH);
  SPI.endTransaction();
}

void setup() {
  Serial.begin(9600);
   pinMode(CS_DIGIPOT,OUTPUT);
   SPI.begin();
}

void loop() {
  for(int f=0; f<40; f++){
    Serial.print("Writing ");
    Serial.print(f); Serial.println("to digipot");  
    write_digipot(f);
    Serial.print("Value:")
    Serial.println(analogRead(A2));
    delay(50);
  }
}

Connect the wire sticking out from the ADJ pin of LM317 from the above diagram to the A2 pin of the Arduino, and run the code.

Do not go above value 40, it will exceed the limit of the analog pins, and likely permanently damage the Arduino. If you need to experiment with higher voltages, add a voltage divider for safety.

  1. How does it work?
    I honestly don't know. I do not really understand the workings and applications of Op-Amps or LM317, and after some research concluded that applying for an electronics lecture would be the only solution. What I could grasp was that, LM358 amplifies voltage from the digipot x5, which is applied to the LM317 ADJ pin, and that the TL431, 2N3904, 480, 180ohm resistors combined act as a current sink of 10mA, which seems like the minimum amount of current draw the LM317 requires.

Before I created the circuit myself, I ran some tests with OrCAD, to see if this worked in 15~18V.
I will replace the additional 9V battery with 15V step up regulator.

This circuit seems to be very fast in terms of response, since PWM with low pass requires like 100ms from my experience. This one I couldn't really grasp how long it took, seemed to be almost immediate, because Arduino serial monitor logs time in like, 50ms in between.

I was able to use 433mHz module with this with no problem. Works all fine, and 433mHz transmitter uses D12, fortunately not occupied by the digipot.

I was worried that LM317 may heat up too much, but it doesn't seem to be a problem at this voltage, unless hermetically sealed in a very tight space or so.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.