Arduino Programming for PE4302 Attenuator

Has anyone tried to put 4 PE4302 in serial connection and with a step of 1 dbm so that by putting 0 dbm in the input, you get 126 dbm from the output (31.5 X 4 = 126)?

Of course always following all the appropriate grounding and shielding so that the result is satisfactory;

With program execution from Arduino UNO or NANO and 2X16 Display;

If so, I would like his opinion, because I did a serial project but with a program he gave me or AI (Technical Intelligence) but unfortunately it didn't work well!

Sincerely

Evangelos

sv1iyb@gmail.com

Arduino nano + 3 x 74hc595?

I am not dure where you are going with this but when we use dbm it is a reference to 1.0 mW. 0 dbm = 1.0 mW. When we say 126 dbm we are saying 3,981,071,705.535 Watts. Without getting into db calculations you can figure every 3.0 dbm change doubles the power. 0 dbm = 1.0 mW, 3.0 dbm = 2.0 mW . I suggest you give this a read.

dBm, or decibel-milliwatt, is a logarithmic unit of absolute power level referenced to one milliwatt (mW). It is widely used in radio frequency (RF) engineering, telecommunications, and fiber-optic networking to measure signal strength.

The PE4302 family is nothing more than a voltage controlled attenuator so you may want to focus on negative numbers. Remember dbm references power and we also can have dba (audio) and dbv (voltage) to name a few.

Ron

The TS is a radio amateur, and if he uses the word "attenuator," it means the signal will be attenuated; otherwise, he would have used the word "amplifier." Attenuated by -126 decibels would be nonsense.

So post the code you tried so we can see where it is wrong.
Also show a schematic of how you have the attenuators connected to the Uno

Yes I am a radio amateur and I am building an RF generator. I will try to send you both the program and the design I use. This is supposed to put 4 PE4302 in series, the first 31dbm should be taken (probably) from the first one and the rest should do nothing and then the second one should do the same and so on. Thank you very much for the prompt response! Sincerely

PE4302_RF_Attenuator_LCD_2.ino (2.8 KB)

DATA goes all together and takes from pin D 11 and CLK again all together and takes from PIN 12 LEs get each separately as shown in the photo!

 digitalWrite(LE, LOW);

  for (int i = 6; i >= 0; i--) {
    digitalWrite(CLK, LOW);
    digitalWrite(DATA, (value >> i) & 0x01);
    digitalWrite(CLK, HIGH);
  }

What's the problem? Is at least one attenuator controlled?

int PIN_CLK = 0;
int PIN_DATA = 2;
int PIN_LE = 4;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("В работе");
  pinMode(PIN_CLK, OUTPUT);
  pinMode(PIN_DATA, OUTPUT);
  pinMode(PIN_LE, OUTPUT);
  digitalWrite(PIN_CLK, LOW);
  digitalWrite(PIN_DATA, LOW);
  digitalWrite(PIN_LE, HIGH);
}

void loop() {

  static int value = 0;
  digitalWrite(PIN_LE, LOW);
  for (int i = 6; i >= 0; i--) {
    digitalWrite(PIN_CLK, LOW);
    delayMicroseconds(10);
    digitalWrite(PIN_DATA, (value >> i) & 0x01);
    delayMicroseconds(10);
    digitalWrite(PIN_CLK, HIGH);
    delayMicroseconds(22);
  }

  delayMicroseconds(10);
  digitalWrite(PIN_CLK, LOW);
  delayMicroseconds(10);
  digitalWrite(PIN_DATA, LOW);
  delayMicroseconds(10);
  digitalWrite(PIN_LE, HIGH);
  
  value++;
  if (value > 32) value = 0;
  delayMicroseconds(100);
}

  for (int i = 6; i > 0; i--) {

for (int i = 5; i >= 0; i--) { // !!!

“The TS is a radio amateur, and if he uses the word "attenuator," it means the signal will be attenuated; otherwise, he would have used the word "amplifier." Attenuated by -126 decibels would be nonsense”.

I get that, my point is we are not looking at dbm but simply db. I got my first ticket in ‘63. The dbm is a reference to 1.0 mW. I gave the thread starter links so they could better understand db verse dbm.

Ron

I know the difference between decibels and decibels of power. You're right about that. Attenuators operate in decibels (on all the devices I've seen, they need to be converted to power).

But that's not the point. We're looking for a problem in the code. I showed one: an extra bit in the protocol and delays need to be addressed. It doesn't need a high interface speed, so you can enter a conveniently analyzed speed in the protocol.

Hi, @sv1iyb

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Cut and paste images do not give clear information.

Can you post some images of your project?
So we can see your component layout.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Hi, @sv1iyb
Did you Google;

PE4302 Arduino

Have you looked for a library.

Can you please post link to where you purchased the attenuator and a link to data sheet?

You do have the attenuator configured correctly?
From eBay, I get this.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

A library for such a simple device?
I think it's unnecessary, if not harmful.

1 Like

Why, it should provide @sv1iyb with working code to test the module and connections.

@sv1iyb went to chatGPT for code, so may not yet have the experience to confidently code.

Tom.... :smiley: :+1: :coffee: :australia:

DeepSeek lib ;-))

OK you have given the schematic. Now as requested, we need to see your code.

We can't tell what you are doing wrong if we can't see what you are doing.

Also a data sheet for the PE4302 modules would help us debug your problem

The pdf of PE4302 you requested
The circuit is simple and as I explained above.
I actually don't know how to program Arduino so I resorted to chatGPT for the code!
If anyone manages to solve the problem, please send it to me in .ino and not in some snippet that is wrong because I won't be able to put it in its place!
Thanks

PE4302.pdf (620.6 KB)

As for your code, I sent it above with the name PE4302_RF_Attenuator_LCD_2.ino (2.8 KB) and is in .ino And I'm reposting it below