RF Power Meter Using An AD8317 & Arduino
The ad8317 provides a DC output of between 1.4 volts and 0.4 volts. We can then use this DC output to calculate the input power perfect for connecting to single ball computers, like the Raspberry Pi through an ADC or an Arduino analog, pin. I remember coming across a project by Papa Alpha zero rwe, where he put together a power meter in a nice box with a two line LCD a couple of buttons and a rotary control. They also created a nice program to load onto an Arduino which is the brains behind this project. Now the website covers an explanation of how it all works, along with a schematic and Arduino IDE code, so you can load this onto an Arduino. The schematic shows using a 2 by 24 LCD, but I only had a 16×2 i2c LCD knocking around, so I was quite happily surprised to see a modified version of the project in the downloaded source code that supports an i2c display. The schematic also shows some extra components that are required, such as four resistors, a reference Supply voltage, two switches, a rotary, encoder and then two 10 end capacitors. The output from the ad8317 connects directly to a0 on the Arduino, or, whichever analog pin you choose as long as you set it in code to get the best performance we can from the 10 bit ADC. We use an external voltage reference, which is then fed into the a ref pin on the Arduino.
Of course, you could potentially modify the code to use an ads 1115 ADC, which has 16 bit resolution. Now, once I downloaded the Arduino code, I opened it in the Arduino IDE. There was a couple of settings that I needed to change. The first was the i2c address set for the LCD, and the second was the voltage value for the reference voltage that I decided to use. I think mine worked out to be around 2.48 volts from the little device that I used. My first build was built using some Vera board and yep. It does look extremely messy, but it was just the initial prototype, as I had a rather cunning plan up my sleeve for the final build with the voltage reference board on the left, the Arduino in the middle, the LCD and buttons on the front panel, along with A load of spaghetti looking wires. It was time to fire it up to see if it works for the first test. I just connected a USB cable to the Arduino. This allowed me to make any changes to the code AS required and once plugged in the LCD, lit up and showed some form of life yippee. The buttons appear to work okay, but the rotary control was a little Skippy like it would skip past some of the menu items when turning and the menu system has inbuilt features to allow selection of external attenuated values. These are from 10 DB up to 60 DB, which is great if you want to measure higher power now.
The reason for this is that the ad8317 has a maximum input of around 0 DB, so we need attenuators to protect it if running more power. In fact, from what Ive read, the linearity is only best up to 5 dbm, so use an external attenuator is best and really needed. Now this firmware as we can call it requires calibration for each band that you want to use. The author of The firmware has coded it so that each calibration readings are stored in eprom, now, Im only interested in 13 centimeter power readings, which is 2.4 gigs. For this we need to First Supply an input of 10 dbm and then another at minus 40 dbm. The slope is then calculated and its all safe to eprom. Once the calibration is saved, you can then start using the power meter as required after performing the calibration using some strange method, as I dont have a signal generator that I can rely on. I connected my hack RF to the ad8317 to see if it works and yeah it works nicely now. At this point I could either fit everything into the case and call that job done, but I wasnt happy with how the rotary controller was working and the length and messiness of the cables inside. So I loaded up Kai, Cad and started laying out the circuit as designed by pa0rwe. Now kycad is a tool which lets you design circuits, with drag and drop components and in the grand scheme of things this circuit was extremely basic, with only a few components and connections.
Now, after laying out the circuit, as shown here on the screen, I then switched to the PCB View, and this is where we can now connect each component using tracks. Of course, tracks cannot overlap each other, so in this particular board design. I also utilize The Underneath here we can see all of the components labeled with their values, the Arduino location and connectors or wire holes towards the edges also allows you to view the board in 3D and as this the first time, Ive used kicad. It felt kind of good and had a nice little wow factor while spinning the newly designed board in 3D. So the next step was to find out how I go about getting this board made and what would be the horrendous cost. Well, after some searching, I came across PCB way a company based in China that would make a minimum of five boards for a mere five dollars, thats five dollars for five boards. Now I only needed one but five dollars and you get five is not so bad and luckily PCB way have a plug in which you can install in kikad. So once youre done designing, you can click the button and all of the required files are uploaded automatically to PCB way. Now the postage cost does vary depending on how quick you want your boards. Now I opted for the two day, DHL, which cost thirty dollars, but there are some really cheap ones.
If youre, not in a hurry for your boards and once the orders been checked and accepted, you can log into your account at any time to check on the status. Each part of the process is detailed and you can watch a little video for each step. That explains how its being made now, I think, thats pretty cool in itself. Of course, this is not your actual board, but at least you can see whats being done. A few days later, I received a package from DHL opened it up and there we have it. The board, or should I save five boards that I designed on kikad, were finally in my hand, after an initial inspection of the quality which I was dubious about, considering they were so cheap, all looked, okay, in fact, even the silk screening was done to perfection with My fingers, arms and legs crossed hoping I did not make any mistakes on the circuit. I started to populate the PCB with components now, luckily theres only a few, so it didnt take too long to solder them in with a fresh, newly programmed Arduino Nano. I started to install it into the box and this is the final result on the main board. You can see the Arduino Nano soldered into place alongside the little reference voltage regulator board. Now this is soldered in using some of the resistor legs it holds in place. Just right a few millimeters above the main board, I think if I was going to do this project again, the normal designer board, which has everything on just one board, including the ad8317 now pcby, do offer component placement service too.
So maybe in the future. I might redesign this board properly as youll notice. I soldered the wires directly to the board, as I didnt have any connectors and I forgot to order them and I just wanted to get this board finished. There are some other factors that Ive thought about and thats the length of the wires between the ad8317 output and the board whether there will be any voltage drop and, if so, how. Much as this could potentially provide Force readings as were dealing with micro volts. Also the coax length between the front panel SMA connector and the ad8317 board again. If this board was designed into the main board, then a connector could be placed on the board and flushed to the front panel. We have to remember that Im not building laboratory specific equipment here this is just home, hobby stuff. You also notice another little Buck converter next to the ad8317. This is so that I can feed 13.8 volts from my Shaq power supply and then the buck converter will provide 8 volts to the Arduino. The a317 is powered by the 5 volt Supply from the Arduino, so we dont need to worry about that so its time to turn it on and see if it works and yep its working. The great tree control seems to be working a lot better than before too less skips is turning now without pressing the menu button, which is the green button at the bottom.
The rotary control changes the band. This is because each supported band has its own calibration data. I probably wont calibrate the others until I need them, but calibrating the 13 centimeter band 2.4. Gigahertz will be my priority, not sure if I mentioned, but the rotor encoder is also a push button wired to function as the select button. This just feels quite natural as you go through the menus now, with the meter calibrated or sorts. I then hooked up the hack RF with a 10 DB attenuator in line notice. The screen now shows 10 on the bottom right to indicate that Ive selected an external 10 DB attenuator. As you can see, the display is now showing the output value from the hack RF, hopefully its about right, and I think it is Im pretty sure the hack RF puts out around 10 milliwatts at 2.4 gigahertz. So there we go guys thats my RF power project using an ad8317 logarithmic power detector anyway, if you guys have built something similar to this or have any suggestions or have some thoughts on this, then please, let me know down in the comments below Ill, be interested To read them, of course, nothing can be a fully calibrated, expensive power meter until the next video take care, stay safe and Ill, see you guys in the next one.