Now its time to start soldering the remaining through hole components, which are mostly connectors of one sort or another. You'll need to change the tip on your soldering iron to a thicker one, or use a soldering iron with a thicker tip.
Start by soldering the three PCB mount right-angles SMA sockets J1 to J3. Each of these sockets have five terminals, four of which are ground connections and are connected directly to the metal casing of the socket, which acts as a heatsink. For this reason these sockets are quite difficult to solder - they require a lot of heat and I found that increasing the temperature of my soldering iron helped considerably. Next insert the two multiturn potentiometers VR1 and VR2 and solder them in place, remembering to trim the terminals back flush with the soldered joint.
Next attach PCB pin terminals PL2, PL4, PL5 and PL 6 (which are 5-way, 4-way, 2-way and 2-way terminals respectively) and solder in place. Then insert the two 10-way PCB sockets PL3A and PL3B and solder in place. The DDS module will be plugged into these sockets, but you can solder the DDS module directly on to the Raspberry Pi Wobbulator PCB if you prefer, in which case you won't need the sockets.
Finally, insert the 26-way GPIO header from the underside of the PCB and solder in place. The completed Raspberry Pi Wobbulator is shown below.
And the following photo shows what the underside of the PCB should look like. The two large holes on the Wobbulator PCB line up with the holes in the later versions of the Raspberry Pi PCB and can be used to securely connect the Wobbulator PCB to the Raspberry Pi PCB using PCB spacers if you prefer
All that remains to do is to plug your DDS module into the Wobbulator PCB and then connect the Wobbulator PCB to your Raspberry Pi by plugging it into the GPIO header. The following photo shows the final assembly, ready for testing.
My next blog post will give details of the setup and testing procedures for the Raspberry Pi Wobbulator. If you are interested in getting your hands on a Raspberry Pi Wobbulator PCB or component kit then please visit www.cutpricecables.co.uk/irpiwobbulator.html . The PCB is priced at £12.00, and the PCB plus kit of components is priced at £40. This includes all sales taxes and free worldwide delivery. You can purchase online and pay by credit or debit card, or PayPal.
Monday, 30 December 2013
Sunday, 29 December 2013
Building the Raspberry Pi Wobbulator Kit - Part 1
I took delivery of the the Raspberry Pi Wobbulator PCBs a few days ago and I've put a kit of components together to go with the PCB. The PCB is priced at £12.00, and the PCB plus kit of components is priced at £40. This includes all sales taxes and free worldwide delivery. The PCBs and kits are available here if you are interested. You can purchase online and pay by credit or debit card, or PayPal.
The Raspberry Pi Wobbulator PCB is shown above. Assembly is fairly straight forward, but in this blog post and the next I'll go the assembly step-by-step and highlight any potential problems. This blog post deals with the surface mount components. I assume you have had some experience of soldering surface mount components, but in any case you will need a fine tipped temperature controlled soldering iron, some small diameter solder (0.5mm or smaller), a pair of tweezers and some kind of magnifier. I use a head mounted magnifier which leaves both hands free, but a good illuminated magnifier lamp would also be suitable.
Start off by soldering on the five 1 nF capacitors, C1 to C5 in place. Their positions are clearly marked on the PCB and it doesn't matter what was round they are soldered. These surface mount capacitors do not have their value marked on them, so it is important not to get them mixed up with other value capacitors! So please only work with one value of capacitors at any given time. The following photo shows the PCB with capacitors C1 to C5 soldered in place.
Next, solder the five 100 nF capacitors, C6 to C10 in place. Your PCB should now look the same as shown in the following photo.
Next, solder the five resistors R1 to R5 in place. Unlike the capacitors, the resistors do have their value marked on them in the form of a three digit number. The first two digits represent the value, and the third digit is the multiplier. So, for example, the 56 Ohm resistor R1 is marked "560", which means "56 followed by 0 zeros", in other words, "56". R2 is marked "105" which means "10 followed by 5 zeros", in other words 1000000 Ohms, or 1 M Ohm. Similarly R3 is marked "222", R4 is marked "470" and R5 is marked "103". The following photo shows the PCB with all five resistors in place
Next it's the turn of the discrete semiconductors. There is one transistor U1, and two diodes D1 and D2. The direction in which the diodes are soldered in place is important - they are marked (all be it very faintly) with a line at one end, and this corresponds to the line on the diode symbol. A closeup view of D1 is shown below - you can just about make out the line on the left-hand end of the component.
The following photo shows the PCB with the discrete semiconductors in place.
Finally, it's time to solder the ICs in place. Both ICs are Narrow Body Standard Small Outline Package format, or SOIC_N for short. I soldered them in place by first melting a small amount of solder on each pad on the PCB and then placing the IC in position and carefully pressing each "leg" down with the tip of the soldering iron until the solder melted and attached to the leg. Use whatever method works for you! The following photo shows the PCB with the IC's in position.
Congratulations! That's all the surface mount components in place - time to lie down in a darkened room until your eyesight recovers and your hands stop shaking... hi hi!
My next blog post will deal with soldering the remaining (through hole) components in place.
Start off by soldering on the five 1 nF capacitors, C1 to C5 in place. Their positions are clearly marked on the PCB and it doesn't matter what was round they are soldered. These surface mount capacitors do not have their value marked on them, so it is important not to get them mixed up with other value capacitors! So please only work with one value of capacitors at any given time. The following photo shows the PCB with capacitors C1 to C5 soldered in place.
Next, solder the five 100 nF capacitors, C6 to C10 in place. Your PCB should now look the same as shown in the following photo.
Next, solder the five resistors R1 to R5 in place. Unlike the capacitors, the resistors do have their value marked on them in the form of a three digit number. The first two digits represent the value, and the third digit is the multiplier. So, for example, the 56 Ohm resistor R1 is marked "560", which means "56 followed by 0 zeros", in other words, "56". R2 is marked "105" which means "10 followed by 5 zeros", in other words 1000000 Ohms, or 1 M Ohm. Similarly R3 is marked "222", R4 is marked "470" and R5 is marked "103". The following photo shows the PCB with all five resistors in place
Next it's the turn of the discrete semiconductors. There is one transistor U1, and two diodes D1 and D2. The direction in which the diodes are soldered in place is important - they are marked (all be it very faintly) with a line at one end, and this corresponds to the line on the diode symbol. A closeup view of D1 is shown below - you can just about make out the line on the left-hand end of the component.
The following photo shows the PCB with the discrete semiconductors in place.
Finally, it's time to solder the ICs in place. Both ICs are Narrow Body Standard Small Outline Package format, or SOIC_N for short. I soldered them in place by first melting a small amount of solder on each pad on the PCB and then placing the IC in position and carefully pressing each "leg" down with the tip of the soldering iron until the solder melted and attached to the leg. Use whatever method works for you! The following photo shows the PCB with the IC's in position.
Congratulations! That's all the surface mount components in place - time to lie down in a darkened room until your eyesight recovers and your hands stop shaking... hi hi!
My next blog post will deal with soldering the remaining (through hole) components in place.
Monday, 9 December 2013
Raspberry PI Wobbulator PCB
The Raspberry Pi Wobbulator PCB is shown below. The PCB is double sided and is designed to be mounted directly above the Raspberry Pi motherboard. It was designed using DesignSpark PCB (which is available free from RS Components) and an initial batch of PCBs is currently being manufactured. I hope to take delivery of them some time around Christmas or the New Year.
I hope to make the PCB available on its own, or along with a kit of components for home assembly. I'm currently working on sourcing the various components at the best price possible. The bare PCB on its own will be £12 (£10 + VAT) and this price will include free delivery within the UK. Worldwide delivery is available at a small additional cost depending on your location. I'm still working on putting together the best deal I can for the kit of components.
For the latest information on possible delivery date and pricing I would suggest that you join the rpiwobbulator Yahoo Group. I will be posting up to date information on delivery and pricing as it becomes available on the Yahoo Group rather than on this blog, but you can of course contact me directly if you wish via email.
I hope to make the PCB available on its own, or along with a kit of components for home assembly. I'm currently working on sourcing the various components at the best price possible. The bare PCB on its own will be £12 (£10 + VAT) and this price will include free delivery within the UK. Worldwide delivery is available at a small additional cost depending on your location. I'm still working on putting together the best deal I can for the kit of components.
For the latest information on possible delivery date and pricing I would suggest that you join the rpiwobbulator Yahoo Group. I will be posting up to date information on delivery and pricing as it becomes available on the Yahoo Group rather than on this blog, but you can of course contact me directly if you wish via email.
Friday, 22 November 2013
Finalizing the design of the Raspberry Pi Wobbulator PCB
I've been experimenting with the AD8307 logarithmic amplifier from Analog Devices as a potential replacement for the discrete buffer amplifier / detector stage I used in the Raspberry Pi Wobbulator prototype.
The following screenshot shows the frequency response of an RF crystal as measured by the AD8307 logarithmic amplifier. The horizontal line near the top of the screenshot is the plot obtained when the output from the DDS module was connected directly to the input of the AD8307 log amp.
Compare the above plot to the plot shown below which was obtained when the same frequency sweep was performed but the response was measured by the discrete buffer amplifier /detector stage.
The plot obtained when using the discrete buffer amplifier / detector stage has much more pronounced peaks, but it should also be noted that the frequency of the primary response peak is noticeably higher than when using the AD8307 logarithmic amplifier. I can only assume that the coupling capacitors used on the input to the AD8307 effectively "pulled" the resonant frequency of the RF crystal lower. The horizontal line in the above plot was obtained when the output from the DSS module was connected directly to the input to the discrete buffer amplifier / detector stage.
From the results above It is clear that the AD8307 and the discrete buffer amplifier / detector stage both have their own strengths and weaknesses, so I've decided to include both on the Raspberry Pi Wobbulator PCB! The proposed schematic for the Raspberry Pi Wobbulator PCB is shown below.
The proposed design has an output from the DDS module ("RF OUT"), and two inputs, one of which is connected to a discrete buffer amplifier / detector stage ("RF IN LIN") and the other of which is connected to a AD8307 logarithmic amplifier ("RF IN LOG"). All connections are in the form of PCB mounted SMA sockets, as well as PCB pins.
I'd welcome any comments on (or corrections to) the above schematic because I'm currently putting the finishing touches to the PCB layout, and once this is completed I will be placing an order for a batch of PCB's to be manufactured.
The following screenshot shows the frequency response of an RF crystal as measured by the AD8307 logarithmic amplifier. The horizontal line near the top of the screenshot is the plot obtained when the output from the DDS module was connected directly to the input of the AD8307 log amp.
Compare the above plot to the plot shown below which was obtained when the same frequency sweep was performed but the response was measured by the discrete buffer amplifier /detector stage.
The plot obtained when using the discrete buffer amplifier / detector stage has much more pronounced peaks, but it should also be noted that the frequency of the primary response peak is noticeably higher than when using the AD8307 logarithmic amplifier. I can only assume that the coupling capacitors used on the input to the AD8307 effectively "pulled" the resonant frequency of the RF crystal lower. The horizontal line in the above plot was obtained when the output from the DSS module was connected directly to the input to the discrete buffer amplifier / detector stage.
From the results above It is clear that the AD8307 and the discrete buffer amplifier / detector stage both have their own strengths and weaknesses, so I've decided to include both on the Raspberry Pi Wobbulator PCB! The proposed schematic for the Raspberry Pi Wobbulator PCB is shown below.
The proposed design has an output from the DDS module ("RF OUT"), and two inputs, one of which is connected to a discrete buffer amplifier / detector stage ("RF IN LIN") and the other of which is connected to a AD8307 logarithmic amplifier ("RF IN LOG"). All connections are in the form of PCB mounted SMA sockets, as well as PCB pins.
The outputs from the discrete buffer amplifier / detector stage and AD8307 log amp are connected to channels 1 and 2 on the MCP3424 ADC chip. The other two channels on the ADC chip are terminated in PCB pins so that these channels can be used with an external detector, or just used as general purpose analogue inputs.
I'd welcome any comments on (or corrections to) the above schematic because I'm currently putting the finishing touches to the PCB layout, and once this is completed I will be placing an order for a batch of PCB's to be manufactured.
Wednesday, 20 November 2013
Bias Compensation option added to the RPi Wobbulator software
The Raspberry Pi Wobbulator software has been revised in line with the changes made to the hardware. As a consequence of using the onboard ADC chip instead of the ADC Pi module, the number of user selectable input channels has been reduced from 8 to 4.
I've also introduced a user selectable "Bias" feature which allows the user to choose whether or not to compensate for any bias on the signal going into the ADC. In the initial version of the Raspberry Pi Wobbulator software, bias compensation was performed by default, and could not be disabled. However from my experience using the RPi Wobbulator I realized that compensating for bias is not always desirable, so decided to make it a user selectable option.
When a frequency sweep is performed with the "Bias" compensation option enabled, the "bias" is measured first by measuring output from the detector stage with the DDS turned off .Then the sweep is performed, and the previously measured "bias" is subtracted from each measurement taken. When the "Bias" compensation option is not enabled, the sweep is performed and each measurement is plotted without performing any subtraction.
The following screenshot shows the revised GUI and demonstrates the use of the "Bias" compensation feature. The two red plots are the result of running a sweep with PGA gain set to 1 and then again with it set to 2, without bias compensation selected. The two blue plots are the result of running the same sweeps but this time with the bias compensation selected.
You can see that without bias compensation (red plots) when the PGA gain is increased from 1 to 2 the central peak doubles in height but the whole plot also moves up the screen. When the same sweeps are repeated with the bias compensation option enabled, the central peak doubles in height, but the bottom of the plot stays in (more or less) the same position.
However, if there is a significant bias on the signal going into the ADC chip, using the "Bias" compensation option can lead to "clipping" of the frequency response plot as demonstrated in the following screenshot.
This time the two blue plots are the result of running a sweep with PGA set to 4 and then again with it set to 8, without the bias compensation selected. The two red plots are the result of running the same sweeps but this time with bias compensation selected. You can see clearly that the uppermost red plot has been "clipped" quite severely - this is due to the ADC input becoming "saturated" because of the large bias on the signal.
The revised source code (version 1.1) for the Raspberry Pi Wobbulator software is available on GitHub.
I've also introduced a user selectable "Bias" feature which allows the user to choose whether or not to compensate for any bias on the signal going into the ADC. In the initial version of the Raspberry Pi Wobbulator software, bias compensation was performed by default, and could not be disabled. However from my experience using the RPi Wobbulator I realized that compensating for bias is not always desirable, so decided to make it a user selectable option.
When a frequency sweep is performed with the "Bias" compensation option enabled, the "bias" is measured first by measuring output from the detector stage with the DDS turned off .Then the sweep is performed, and the previously measured "bias" is subtracted from each measurement taken. When the "Bias" compensation option is not enabled, the sweep is performed and each measurement is plotted without performing any subtraction.
The following screenshot shows the revised GUI and demonstrates the use of the "Bias" compensation feature. The two red plots are the result of running a sweep with PGA gain set to 1 and then again with it set to 2, without bias compensation selected. The two blue plots are the result of running the same sweeps but this time with the bias compensation selected.
You can see that without bias compensation (red plots) when the PGA gain is increased from 1 to 2 the central peak doubles in height but the whole plot also moves up the screen. When the same sweeps are repeated with the bias compensation option enabled, the central peak doubles in height, but the bottom of the plot stays in (more or less) the same position.
However, if there is a significant bias on the signal going into the ADC chip, using the "Bias" compensation option can lead to "clipping" of the frequency response plot as demonstrated in the following screenshot.
This time the two blue plots are the result of running a sweep with PGA set to 4 and then again with it set to 8, without the bias compensation selected. The two red plots are the result of running the same sweeps but this time with bias compensation selected. You can see clearly that the uppermost red plot has been "clipped" quite severely - this is due to the ADC input becoming "saturated" because of the large bias on the signal.
The revised source code (version 1.1) for the Raspberry Pi Wobbulator software is available on GitHub.
Saturday, 16 November 2013
Developing the Raspberry Pi Wobbulator design
I've been developing the design of the Raspberry Pi Wobbulator with a view to producing a self contained plugin module for the Raspberry Pi, either as a fully assembled unit or as a PCB and kit of components. This has raised a few fundamental design issues along the way, such as:
I've been exploring various options and trying out different configurations in an attempt resolve these issues.
Use the "Off-the-shelf" DDS module or design my own?
The type of DDS module I use is widely available on eBay and elsewhere, and has been used in various different amateur radio related projects. The module is cheap, small, and easy to use, and quite honestly I don't think I could design and build anything as good for the money! Therefore I've decided to use the off-the-shelf DDS module instead of designing and building one from scratch. The Raspberry Pi Wobbulator PCB will be designed so that the DDS module can either be soldered in place or simply "plugged in". The plugin option opens up the possibility of being able to easily replace the DDS module with a higher spec one (based on the AD9851 or AD9852 chip) should such a module become available.
Use "Surface Mount" or "Through Hole" components?
If the Raspberry Pi Wobbulator will be supplied as a PCB and kit of components, then this is an important issue. However using only "through hole" components seriously limits the choice of components available, and is also becoming an ever more expensive option. Having tried using surface mount components myself and also having conducted a (very unscientific) poll on the Raspberry Pi Wobbulator Yahoo group I've decided to use surface mount components where possible. Some surface mount components are so small that they really aren't suitable for manual assembly, so I'll have to choose the components with care.
Use an Onboard ADC instead of the ADC Pi module?
This one was a "no brainer" - using an onboard ADC is definitely the way to go! It will work out a lot less expensive and will mean that the PCB can connect direct to the GPIO pins on the Raspberry Pi rather than be "stacked" on top of another board. The ADC Pi module uses a pair of MCP3424 ADC chips, and I'm happy to stick with these, although one chip (which has 4 input channels) would suffice. These are only available in surface mount packages, but they are available as SOIC packages which are not too small for manual assembly.
The Adafruit prototype board I used in the construction of the Raspberry Pi Wobbulator has a SOIC surface mount chip breakout area, so I obtained a MCP3424 chip from Microchip and had a go at soldering it in place. The result wasn't too bad for a first attempt - the ADC chip is on the bottom right of the following photo.
I've since connected the MCP3424 up to the GPIO pins and tested it and I'm pleased to say it works perfectly with the original software. The only modification I need to make is to give the user a choice of 4 input channels instead of the 8 that were available on the ADC Pi module.
Can the buffer amp / detector stage be incorporated into the Raspberry Pi Wobbulator PCB design?
The original Raspberry Pi Wobbulator prototype was constructed with the Buffer Amplifier / Detector stage completely separate from the rest of the circuit, with it's own power source (PP3 battery). It was constructed in a die-cast Aluminium box to provide good shielding (see my previous post for full details). I really needed to find a way of incorporating the buffer amp / detector stage into the Raspberry Pi Wobbulator PCB.
In the meantime however I came across the AD8307 chip from Analogue Devices. This chip is a Logarithmic Amplifier and it produces a DC voltage at it's output which is proportional to the level of the RF signal on its input, expressed in Decibels (dB). In other words the output from this chip is proportional to the log of the RF signal strength on its input. However this is a sensitive device and needs to be well shielded.
The AD8307 chip is available in through hole DIP as well as surface mount SOIC packages, so I obtained a through hole DIP device and mounted it on the Adafruit prototype board in an IC socket. I hardwired the output from the AD8307 chip to the input of Channel 1 on the MCP3424 ADC chip and tried it out by repeating the test of the RF crystal (see this previous post for details). The results are shown below:
The blue plot shows the response of the crystal on its own and shows the resonant frequency to be 14070000 Hz. The red plot is the response of the crystal with a 10pF capacitor connected in parallel across the crystal, and shows the resonant frequency to be about 14067500 Hz. I was very pleasantly surprised to see that even though the AD8307 was not shielded, noise did not seem to be a major problem. Certainly based on the results of this test, using the AD8307 warrants further investigation
The following photo shows the modified Raspberry Pi Wobbulator prototype with onboard ADC chip (bottom left) and onboard logarithmic amplifier chip AD8307 (bottom right).
So there you have it! I believe I've developed the design of the Raspberry Pi Wobbulator to the point where it is perfectly faesible to design a PCB as a simple plugin module for the Raspberry Pi, and this is what I will be concentrating my efforts on over then next few days and weeks
- Use the off-the-shelf DDS module or design my own DDS using the AD9850 chip?
- Use surface mount or through hole components?
- Use an onboard ADC instead of the ADC Pi module?
- Can the buffer amp / detector stage (currently a completely separate module) be incorporated into the Raspberry Pi Wobbulator PCB design?
I've been exploring various options and trying out different configurations in an attempt resolve these issues.
Use the "Off-the-shelf" DDS module or design my own?
The type of DDS module I use is widely available on eBay and elsewhere, and has been used in various different amateur radio related projects. The module is cheap, small, and easy to use, and quite honestly I don't think I could design and build anything as good for the money! Therefore I've decided to use the off-the-shelf DDS module instead of designing and building one from scratch. The Raspberry Pi Wobbulator PCB will be designed so that the DDS module can either be soldered in place or simply "plugged in". The plugin option opens up the possibility of being able to easily replace the DDS module with a higher spec one (based on the AD9851 or AD9852 chip) should such a module become available.
Use "Surface Mount" or "Through Hole" components?
If the Raspberry Pi Wobbulator will be supplied as a PCB and kit of components, then this is an important issue. However using only "through hole" components seriously limits the choice of components available, and is also becoming an ever more expensive option. Having tried using surface mount components myself and also having conducted a (very unscientific) poll on the Raspberry Pi Wobbulator Yahoo group I've decided to use surface mount components where possible. Some surface mount components are so small that they really aren't suitable for manual assembly, so I'll have to choose the components with care.
Use an Onboard ADC instead of the ADC Pi module?
This one was a "no brainer" - using an onboard ADC is definitely the way to go! It will work out a lot less expensive and will mean that the PCB can connect direct to the GPIO pins on the Raspberry Pi rather than be "stacked" on top of another board. The ADC Pi module uses a pair of MCP3424 ADC chips, and I'm happy to stick with these, although one chip (which has 4 input channels) would suffice. These are only available in surface mount packages, but they are available as SOIC packages which are not too small for manual assembly.
The Adafruit prototype board I used in the construction of the Raspberry Pi Wobbulator has a SOIC surface mount chip breakout area, so I obtained a MCP3424 chip from Microchip and had a go at soldering it in place. The result wasn't too bad for a first attempt - the ADC chip is on the bottom right of the following photo.
I've since connected the MCP3424 up to the GPIO pins and tested it and I'm pleased to say it works perfectly with the original software. The only modification I need to make is to give the user a choice of 4 input channels instead of the 8 that were available on the ADC Pi module.
Can the buffer amp / detector stage be incorporated into the Raspberry Pi Wobbulator PCB design?
The original Raspberry Pi Wobbulator prototype was constructed with the Buffer Amplifier / Detector stage completely separate from the rest of the circuit, with it's own power source (PP3 battery). It was constructed in a die-cast Aluminium box to provide good shielding (see my previous post for full details). I really needed to find a way of incorporating the buffer amp / detector stage into the Raspberry Pi Wobbulator PCB.
In the meantime however I came across the AD8307 chip from Analogue Devices. This chip is a Logarithmic Amplifier and it produces a DC voltage at it's output which is proportional to the level of the RF signal on its input, expressed in Decibels (dB). In other words the output from this chip is proportional to the log of the RF signal strength on its input. However this is a sensitive device and needs to be well shielded.
The AD8307 chip is available in through hole DIP as well as surface mount SOIC packages, so I obtained a through hole DIP device and mounted it on the Adafruit prototype board in an IC socket. I hardwired the output from the AD8307 chip to the input of Channel 1 on the MCP3424 ADC chip and tried it out by repeating the test of the RF crystal (see this previous post for details). The results are shown below:
The blue plot shows the response of the crystal on its own and shows the resonant frequency to be 14070000 Hz. The red plot is the response of the crystal with a 10pF capacitor connected in parallel across the crystal, and shows the resonant frequency to be about 14067500 Hz. I was very pleasantly surprised to see that even though the AD8307 was not shielded, noise did not seem to be a major problem. Certainly based on the results of this test, using the AD8307 warrants further investigation
The following photo shows the modified Raspberry Pi Wobbulator prototype with onboard ADC chip (bottom left) and onboard logarithmic amplifier chip AD8307 (bottom right).
So there you have it! I believe I've developed the design of the Raspberry Pi Wobbulator to the point where it is perfectly faesible to design a PCB as a simple plugin module for the Raspberry Pi, and this is what I will be concentrating my efforts on over then next few days and weeks
Wednesday, 30 October 2013
Using the Raspberry Pi Wobbulator to test the G6LBQ Multiband Bandpass Filter
Finally, I decided to use the Raspberry Pi Wobbulator to test the frequency response characteristics of the G6LBQ multiband bandpass filter which I had built as part of a homebrew transceiver project. The fully assembled filter board is shown below (it is part of a Bitx Transceiver project I'm working on) and it covers the whole HF spectrum in 9 bands, all the way from the 160m band (1.8 - 2.0 Mhz) to the 10m band (28 - 30 MHz). Each bandpass filter uses a 3rd order Butterworth design and built using the "redeveloped" component kit from Spectrum Communications. Please note that there is a revised and improved version of the G6LBQ multiband bandpass filter due out very shortly - see the DX KITS web site for details.
Prior to testing with the Raspberry Pi Wobbulator, each bandpasss filter was adjusted to give peak responses at the following frequencies on each band by connecting an RF signal generator to the input of the filter and measuring the output on an Oscillioscope (which is the "normal" way of adjusting such filters).
A screenshot of the results obtained from testing the 80m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 3 MHz to 4 MHz in increments of 10 KHz, and the response shows a nice peak around 3.6 MHz.
A screenshot of the results obtained from testing the 40m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 6.6 MHz to 7.6 MHz in increments of 10 KHz. Although the response of the filter peaks around 7.1 MHz the response curve would suggest that the various filter elements are not well aligned.
A screenshot of the results obtained from testing the 10m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 27 MHz to 31 MHz in increments of 10 KHz. The response has a peak around 29 MHz, and a secondary peak around 28 MHz, indicating possible misalignment of the filter.
Clearly using the Raspberry Pi Wobbulator to test the multiband bandpass filter provided much more information than could be obtained by simply peaking the response of the filter at a single frequency. The Raspberry Pi Wobbulator performed extremely well across the whole HF spectrum and produced some very useful results, however some care is required when specifying frequency sweep parameters - if a large sweep is specified with a small increment, the sweep can take a considerable amount of time to complete.
For the radio amateur or electronic hobbyist, the Raspberry Pi Wobbulator provides a cost effective alternative to a “conventional” Wobbulator (or Sweep Generator, which also requires an Oscilloscope), or a Spectrum Analyser (which is beyond beyond the budget of most hobby users) for examining the frequency response characteristics of a circuit.
Having shown that the Raspberry Pi Wobbulator is a viable proposition, I hope to go on to develop it into a single plugin module for the Raspberry Pi. You can follow the progress of this project here and I've also setup a Yahoo Group here for discussion of all things Raspberry Pi Wobbulator related
Also please note that I have just received a small number of the DDS modules from the manufacturer in China - if you would like one please email me.
Prior to testing with the Raspberry Pi Wobbulator, each bandpasss filter was adjusted to give peak responses at the following frequencies on each band by connecting an RF signal generator to the input of the filter and measuring the output on an Oscillioscope (which is the "normal" way of adjusting such filters).
- 160m band - adjusted for peak response at 1.9 MHz
- 80m band - adjusted for peak response at 3.6 MHz
- 40m band - adjusted for peak response at 7.1 MHz
- 30m band - adjusted for peak response at 10.1 MHz
- 20m band - adjusted for peak response at 14.2 MHz
- 17m band - adjusted for peak response at 18.1 MHz
- 15m band - adjusted for peak response at 21.2 MHz
- 12m band - adjusted for peak response at 24.9 MHz
- 10m band - adjusted for peak response at 29.0 MHz
A screenshot of the results obtained from testing the 80m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 3 MHz to 4 MHz in increments of 10 KHz, and the response shows a nice peak around 3.6 MHz.
A screenshot of the results obtained from testing the 40m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 6.6 MHz to 7.6 MHz in increments of 10 KHz. Although the response of the filter peaks around 7.1 MHz the response curve would suggest that the various filter elements are not well aligned.
A screenshot of the results obtained from testing the 30m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 9 MHz to 11 MHz in increments of 10 KHz. The response shows a peak around 10.1 MHz, but the response has a "shoulder" around 9.8 MHz which may indicate that the filter is not perfectly aligned.
A screenshot of the results obtained from testing the 20m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 13 MHz to 15 MHz in increments of 10 KHz. The response shows a peak around 14.2 MHz, and the useable bandwith would be between 14.0 MHz and 14.4 MHz, but again the response has a distinct "shoulder" on the lower side which may indicate that the filter is not well aligned.
A screenshot of the results obtained from testing the 17m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 17.1 MHz to 19.1 MHz in increments of 10 KHz. The response shows a peak around 18.3 MHz, which is too high, and there is a "shoulder" around 17.9 MHz.
A screenshot of the results obtained from testing the 15m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 20 MHz to 22 MHz in increments of 10 KHz. The response shows a peak around 21.4 MHz, which is too high side for this band, and again the response if not symmetrical either side of the peak indicating possible misalignment.
A screenshot of the results obtained from testing the 12m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 24.2 MHz to 26.2 MHz in increments of 100 KHz. The response shows a broad peak around 25.2 MHz, which is too high for this band.
A screenshot of the results obtained from testing the 10m bandpass filter is shown below, using channel 1 on the ADC Pi module with PGA gain of 8x. The wobbulator performed a sweep from 27 MHz to 31 MHz in increments of 10 KHz. The response has a peak around 29 MHz, and a secondary peak around 28 MHz, indicating possible misalignment of the filter.
Clearly using the Raspberry Pi Wobbulator to test the multiband bandpass filter provided much more information than could be obtained by simply peaking the response of the filter at a single frequency. The Raspberry Pi Wobbulator performed extremely well across the whole HF spectrum and produced some very useful results, however some care is required when specifying frequency sweep parameters - if a large sweep is specified with a small increment, the sweep can take a considerable amount of time to complete.
For the radio amateur or electronic hobbyist, the Raspberry Pi Wobbulator provides a cost effective alternative to a “conventional” Wobbulator (or Sweep Generator, which also requires an Oscilloscope), or a Spectrum Analyser (which is beyond beyond the budget of most hobby users) for examining the frequency response characteristics of a circuit.
Having shown that the Raspberry Pi Wobbulator is a viable proposition, I hope to go on to develop it into a single plugin module for the Raspberry Pi. You can follow the progress of this project here and I've also setup a Yahoo Group here for discussion of all things Raspberry Pi Wobbulator related
Also please note that I have just received a small number of the DDS modules from the manufacturer in China - if you would like one please email me.
Monday, 28 October 2013
Using the Raspberry Pi Wobbulator to test a RF Crystal and an IF Transformer
First of all I used the Raspberry Pi Wobbulator to examine the frequency response characteristics of an RF Crystal. One side of the crystal was connected to the output from the DDS module and the other side was connected to the input to the Buffer Amplifier / Detector. The outer metal casing of the crystal was grounded using a crocodile clip, and the crystal was tested with and without a small (10pF) capacitance in parallel. This capacitance was added simply by connecting the capacitor across the crystal using a pair of miniature crocodile clips.
The nominal frequency of the crystal being tested was 14.070 MHz so the start frequency for the sweep was set to 14.060 MHz and the stop frequency for the sweep was set to 14.080 MHz and the increment was set to 100 Hz. Channel 2 was selected on the ADC Pi module and the PGA gain was set to 1x. The results are shown in the following screenshot.
The blue plot shows the response of the crystal on its own and shows the resonant frequency to be just above 14072000 Hz. The red plot is the response of the crystal with a 10pF capacitor connected in parallel across the crystal, and shows the resonant frequency to be a little over 14068000 Hz. This demonstrates nicely how the resonant frequency of the crystal can be “pulled” by adding a small capacitance in parallel.
The nominal frequency of the crystal being tested was 14.070 MHz so the start frequency for the sweep was set to 14.060 MHz and the stop frequency for the sweep was set to 14.080 MHz and the increment was set to 100 Hz. Channel 2 was selected on the ADC Pi module and the PGA gain was set to 1x. The results are shown in the following screenshot.
The blue plot shows the response of the crystal on its own and shows the resonant frequency to be just above 14072000 Hz. The red plot is the response of the crystal with a 10pF capacitor connected in parallel across the crystal, and shows the resonant frequency to be a little over 14068000 Hz. This demonstrates nicely how the resonant frequency of the crystal can be “pulled” by adding a small capacitance in parallel.
Then I decided to use the Raspberry Pi Wobbulator to test the frequency response characteristics of a small IF transformer coil (TOKO Part RMC15002A - see photo below). This is a 455 kHz RF transformer and is typical of those used in the IF stages of many HF receivers. Proper alignment of the IF stages of a Superhet receiver is critical for good performance and it was for this task that a "conventional" Wobbulator was typically used, so I considered this to be an important test for the Raspberry Pi Wobbulator.
The frequency sweep was set to start at 200 KHz and finish at 700 KHz, with an increment of 1 KHz. Channel 2 was selected on the ADC Pi module and the PGA gain was set to 1x. The results are shown in the screenshot below.
The results show the response to peak at just over 450 kHz as would be expected. The results from this test and from testing the RF Crystal both demonstrate the effectiveness of the Raspberry Pi Wobbulator for measuring the frequency response characteristics of a component.
In my next post I'll discuss how I used the Raspberry Pi Wobbulator to test a multiband bandpass filter.
In my next post I'll discuss how I used the Raspberry Pi Wobbulator to test a multiband bandpass filter.
Saturday, 26 October 2013
Developing the Raspberry Pi Wobbulator Software
The Raspberry Pi Wobbulator software was all written in Python 3, which seems to be the programming language of choice as far as the Raspberry Pi community is concerned, perhaps because it comes ready to use with the Raspbian "Wheezy" operating system. The software was written using IDLE 3 (the Python 3 Integrated Development Environment supplied with the Raspbian "Wheezy" operating system). To launch IDLE 3, double click on the IDLE 3 on the LXDE desktop. This will open the "Python Shell" window as shown below.
From here you can enter commands directly for immediate execution, or you can open a Python file to work on, or create a new file by clicking on the "File" menu and choosing the appropriate action.
The Graphical User Interface (GUI) for the Raspberry Pi Wobbulator was designed and programmed using Tkinter - the GUI programming toolkit supplied with Python. Although it is not a WYSIWYG GUI design tool, Tkinter is the most commonly used GUI toolkit, and can be used to create simple GUI’s fairly easily. For details of the Tkinter package and links to Tkinter documentation, please visit the Python website. There's also an excellent online Tkinter reference written by John W. Shipman if you're interested in learning how to use Tkinter. A screenshot of the Raspberry Pi Wobbulator GUI is shown below.
The user can enter parameters for the frequency sweep along the bottom of the screen. The various buttons down the right hand side of the main window allow the user to select the input channel (Ch) on the ADC Pi module, the gain for the PGA, and the line colour used to plot the response curve. The “RUN” button initiates the frequency sweep, and the response curve of the circuit under test is plotted in the “results area” (the large cyan coloured area taking up most of the main window). The X-axis on the results area represents frequency from the “start frequency” on the left to the “stop frequency” on the right and the Y-axis represents the magnitude of the signal passing through the circuit under test, as measured by the ADC Pi module.
The user can choose whether or not to display a grid over the results area, and the “CLS” button clears the results area of any previous plots.
Event handlers were written for the various GUI “widgets” and the test code for the DDS module and ADC module was modified and incorporated into the program to implement the low level communication between the hardware modules and the Raspberry Pi’s GPIO header.
The source code for the Raspberry Pi Wobbulator can be downloaded from Github, or you can use the "git clone" command to download a copy of the repository on to your Raspberry Pi. To do this, type the following at the command line prompt and press Enter:
pi@raspberrypi ~ $ git clone https://github.com/mi0iou/RPi_Wobbulator.git_
When you execute this command, a new folder called "RPi_Wobbulator" will be created under "/home/pi" and the source code (and other files) will be downloaded and saved in this folder. You will see the following messages in the terminal window (or at the command line prompt) as this takes place.
Now if you launch IDLE 3 you can open the file "rpi_wobbulator.py" and run it by selecting "Run->RunModule" or by pressing "F5".
In my next posts I'll discuss some of the results obtained when the Raspberry Pi Wobbulator was used to examine the frequency response characteristics of an RF crystal, an IF transformer, and a multiband bandpass filter.
From here you can enter commands directly for immediate execution, or you can open a Python file to work on, or create a new file by clicking on the "File" menu and choosing the appropriate action.
The Graphical User Interface (GUI) for the Raspberry Pi Wobbulator was designed and programmed using Tkinter - the GUI programming toolkit supplied with Python. Although it is not a WYSIWYG GUI design tool, Tkinter is the most commonly used GUI toolkit, and can be used to create simple GUI’s fairly easily. For details of the Tkinter package and links to Tkinter documentation, please visit the Python website. There's also an excellent online Tkinter reference written by John W. Shipman if you're interested in learning how to use Tkinter. A screenshot of the Raspberry Pi Wobbulator GUI is shown below.
The user can enter parameters for the frequency sweep along the bottom of the screen. The various buttons down the right hand side of the main window allow the user to select the input channel (Ch) on the ADC Pi module, the gain for the PGA, and the line colour used to plot the response curve. The “RUN” button initiates the frequency sweep, and the response curve of the circuit under test is plotted in the “results area” (the large cyan coloured area taking up most of the main window). The X-axis on the results area represents frequency from the “start frequency” on the left to the “stop frequency” on the right and the Y-axis represents the magnitude of the signal passing through the circuit under test, as measured by the ADC Pi module.
The user can choose whether or not to display a grid over the results area, and the “CLS” button clears the results area of any previous plots.
Event handlers were written for the various GUI “widgets” and the test code for the DDS module and ADC module was modified and incorporated into the program to implement the low level communication between the hardware modules and the Raspberry Pi’s GPIO header.
The source code for the Raspberry Pi Wobbulator can be downloaded from Github, or you can use the "git clone" command to download a copy of the repository on to your Raspberry Pi. To do this, type the following at the command line prompt and press Enter:
pi@raspberrypi ~ $ git clone https://github.com/mi0iou/RPi_Wobbulator.git_
When you execute this command, a new folder called "RPi_Wobbulator" will be created under "/home/pi" and the source code (and other files) will be downloaded and saved in this folder. You will see the following messages in the terminal window (or at the command line prompt) as this takes place.
Now if you launch IDLE 3 you can open the file "rpi_wobbulator.py" and run it by selecting "Run->RunModule" or by pressing "F5".
In my next posts I'll discuss some of the results obtained when the Raspberry Pi Wobbulator was used to examine the frequency response characteristics of an RF crystal, an IF transformer, and a multiband bandpass filter.
Thursday, 24 October 2013
Adding an Envelope Detector to convert an RF input to a DC output
I connected the ADC Pi module to the GPIO header and stacked the DDS module on top. PCB support spacers were used to hold the modules together and to take the strain off the GPIO pins.
And here's how it looks from the other side...
All that was left to do was to use a simple envelope detector to convert the RF coming out on the circuit under test into a DC voltage that could be measured by the ADC Pi module - time for a little bit of theory...
A simple envelope detector is shown above. It consists of only three components - a diode, a capacitor and a resistor. An RF signal (Vi) is fed into the detector and a DC signal (Vo) comes out the other end. The RF input (blue line) and DC output (red line) signals are plotted below.
When I tried using a simple envelope detector I discovered that I was getting little or no signal out of the envelope detector. So much for the theory! I measured the peak RF voltage coming out of the circuit under test I found it to be around 0.2Volts (200mV) - this was the cause of the problem! Time for some more theory...
With reference to the graph above, a diode needs a certain level of forward voltage "Vd" to "turn it on". For a Silicon diode this voltage is about 0.7 Volts and for a Germanium this voltage is around 0.25 Volts (250 mV), which is around the same level as (or greater than) the peak RF signal voltage I was trying to detect. Therefore the RF signal I was trying to detect and measure was insufficient to drive the simple envelope detector.
The solution was to use a buffer amplifier with a high input impedance and a biased detector stage to convert of the RF signals to a DC voltage. A design by Rodney Byne for the front end of a Wideband RF Millivoltmeter was adopted and modified for use with the RPi Wobbulator. The circuit diagram is shown below:
The circuit uses a JFET transistor in “source follower” configuration, which has a gain of less than 1, but has a very high input impedance, therefore minimising the loading on the circuit under test. Diodes D1 and D2 are both Schottky type 1N5711 which have good RF bandwidth. With no RF input, VR1 was adjusted for a quiescent bias voltage of about 0.25 V (250mV). This seemed to be a good compromise between quiescent power consumption and linear performance when dealing with small RF signals.
And here's how it looks from the other side...
All that was left to do was to use a simple envelope detector to convert the RF coming out on the circuit under test into a DC voltage that could be measured by the ADC Pi module - time for a little bit of theory...
A simple envelope detector is shown above. It consists of only three components - a diode, a capacitor and a resistor. An RF signal (Vi) is fed into the detector and a DC signal (Vo) comes out the other end. The RF input (blue line) and DC output (red line) signals are plotted below.
When I tried using a simple envelope detector I discovered that I was getting little or no signal out of the envelope detector. So much for the theory! I measured the peak RF voltage coming out of the circuit under test I found it to be around 0.2Volts (200mV) - this was the cause of the problem! Time for some more theory...
With reference to the graph above, a diode needs a certain level of forward voltage "Vd" to "turn it on". For a Silicon diode this voltage is about 0.7 Volts and for a Germanium this voltage is around 0.25 Volts (250 mV), which is around the same level as (or greater than) the peak RF signal voltage I was trying to detect. Therefore the RF signal I was trying to detect and measure was insufficient to drive the simple envelope detector.
The solution was to use a buffer amplifier with a high input impedance and a biased detector stage to convert of the RF signals to a DC voltage. A design by Rodney Byne for the front end of a Wideband RF Millivoltmeter was adopted and modified for use with the RPi Wobbulator. The circuit diagram is shown below:
The circuit uses a JFET transistor in “source follower” configuration, which has a gain of less than 1, but has a very high input impedance, therefore minimising the loading on the circuit under test. Diodes D1 and D2 are both Schottky type 1N5711 which have good RF bandwidth. With no RF input, VR1 was adjusted for a quiescent bias voltage of about 0.25 V (250mV). This seemed to be a good compromise between quiescent power consumption and linear performance when dealing with small RF signals.
The Buffer Amp / Detector was constructed on a prototype board and housed in a diecast aluminium box. A PP3 battery was used to power the circuit. The completed Buffer Amp / Detector is shown below.
The Buffer Amplifier / Detector was tested at
various frequencies and at various input levels, and the DC output (minus the
quiescent bias voltage) was found to be approximately equal to the peak voltage
of the RF signal applied to the input. In other words, when a 0.2 Volt (200mV) peak RF signal was applied to the input of the Buffer Amplifier / Detector, the DC output from the Buffer Amplifier / Detector was approximately 0.2 Volts (200mV), plus the the quiescent bias voltage. This is well within the measurement capabilities of the ADC Pi module. Happy days!
So that about wraps it up for the hardware side of the Raspberry Pi Wobbulator. In my next post I'll discuss the development of the Raspberry Pi Wobbulator software.
So that about wraps it up for the hardware side of the Raspberry Pi Wobbulator. In my next post I'll discuss the development of the Raspberry Pi Wobbulator software.
Tuesday, 22 October 2013
Measuring DC voltages on the Raspberry Pi using the ADC Pi module
The Raspberry Pi does not have a built in analogue to digital converter (ADC) so a suitable “external” ADC module had to be found. I chose the ADC Pi module from Abelectronics because of its multiple 18 bit input channels and its i2c interface. It also had the advantage of having a “stackable” design so that once connected to the Raspberry Pi’s GPIO header, it allowed other modules to be stacked on top.
Although this post deals with how to use ADC Pi module in the context of the Raspberry Pi Wobbulator, the information contained here is applicable to ANY situation where you want to use the Raspberry Pi to measure a DC voltage (e.g. analogue sensors like LDR's, thermistors etc). The ADC Pi module is extremely versatile.
All 8 input channels on the ADC Pi module have a built-in potential divider giving an effective input voltage range of approximately 0 to 5V DC. However considering the low level output of the DDS module, I decided to remove the potential divider on Channel 1 and connect the input directly to the ADC chip, thus reducing the input voltage range to approximately 0 to 2V DC. Some right angled PCB pins were also soldered to the input terminals on the ADC Pi module to provide easy connection of “flying leads”.
Now you need to install the “i2c-tools” package. Entering the following at the command prompt and press Enter:
pi@raspberrypi ~ $ sudo apt-get install i2c-tools_
Add your user name to the i2c group by entering the following at the command prompt (assuming your user name is “pi”) and pressing Enter:
pi@raspberrypi ~ $ sudo adduser pi i2c_
Now it's time to power down your Raspberry Pi and plug the ADC Pi module into the GPIO header.
After you reboot your Raspberry Pi, enter the following at the command line prompt and press Enter:
pi@raspberrypi ~ $ i2cdetect -y 1_
This should detect the presence of the ADC Pi module and display the address of the i2c bus as shown below.
The ADC Pi module uses the Quick2Wire library to allow easy access to the I2C port from Python 3. You need to download and install the Quick2Wire library, but first you need to download and install Setuptools.
Download the most up-to-date version of Setuptools (currently v1.1.6) from the Python website. Extract the “.tar.gz” package, go to the folder called “/setuptools-1.1.6” and enter the following at the command line prompt and press Enter:
.../setuptools-1.1.6 $ sudo python3 ez_setup.py_
Now download the Quick2Wire Python API package from GitHub. Extract the ".zip" file, go to the folder called “/quick2wire-python-api-master” and enter the following at the command line prompt and press Enter:
.../quick2wire-python-api-master $ sudo python3 setup.py install_
Download the "adcpiv2" sample code from GitHub. Launch IDLE3 and open the file "adcpiv2.py" and run it by selecting "Run->Run Module (or by pressing "F5"). The program continually takes readings from channel 1 on the ADC Pi module and displays the results on the Python Shell window. The results shown in the screenshot below were obtained by connecting a “AA” battery to the input of channel 1 on the ADC Pi module while the program was running.
Congratulations! You've just made the world's most complex battery tester! You can stop the program running by pressing "Ctrl + C" when the Python Shell window is active.
So now we have a Raspberry Pi capable of generating an RF signal (see my previous post) and measuring an analogue DC signal. The final part of hardware required for the Raspberry Pi Wobbulator is some sort of detector to convert the RF coming out of the circuit under test into an analogue DC signal. That will be the subject of my next post.
Although this post deals with how to use ADC Pi module in the context of the Raspberry Pi Wobbulator, the information contained here is applicable to ANY situation where you want to use the Raspberry Pi to measure a DC voltage (e.g. analogue sensors like LDR's, thermistors etc). The ADC Pi module is extremely versatile.
All 8 input channels on the ADC Pi module have a built-in potential divider giving an effective input voltage range of approximately 0 to 5V DC. However considering the low level output of the DDS module, I decided to remove the potential divider on Channel 1 and connect the input directly to the ADC chip, thus reducing the input voltage range to approximately 0 to 2V DC. Some right angled PCB pins were also soldered to the input terminals on the ADC Pi module to provide easy connection of “flying leads”.
In the photo above the input pins that I added are on the left and the pins on the right are the “address select” pins for the onboard ADC chip (but you really don't need to worry these - just leave the jumpers where they are). The modified input to Channel 1 can clearly be seen in the above photo - apologies for the crude soldering - I have since learned how to solder surface mount components, and bought a fine tipped iron...
The ADC Pi module has an onboard programmable gain amplifier (PGA) for each input channel with a user selectable gain of 1x, 2x, 4x and 8x, effectively increasing the sensitivity of the input channels by a factor of up to 8. Thus the input voltage range of Channel 1 will be approximately 0 to 250mV DC if the maximum gain is selected, which is of the same order of magnitude as the peak output from the DDS module. Abelectronics provide some sample Python software for communicating with and controlling the ADC Pi module. This software is available on GitHub and gives examples of how to take readings from the ADC Pi module and how to specify the input channel and select the gain of the PGA. The ADC Pi module uses I2C protocol to communicate with the Raspberry Pi, and this uses GPIO pins 3 and 5 (GPIO2 and GPIO3 on the Raspberry Pi Rev 2 board). However, I2C is not enabled by default on the Raspberry Pi, so there are a few preparatory tasks you need to perform before you can connect and use the ADC Pi module:
Open the file “/etc/modprobe.d/raspi-blacklist.conf” in Leafpad, go to the end of the file and "comment out" the last line by inserting a ‘#’ at the start of the line so that it looks like as shown below. Then save and close the file but please note that you will need root privileges to do so.
Open the file “/etc/modules” in Leafpad and add the line "i2c-dev" to the end of the file so that it looks like as shown below. Then save and close the file.
Open the file “/etc/modules” in Leafpad and add the line "i2c-dev" to the end of the file so that it looks like as shown below. Then save and close the file.
Now you need to install the “i2c-tools” package. Entering the following at the command prompt and press Enter:
pi@raspberrypi ~ $ sudo apt-get install i2c-tools_
Add your user name to the i2c group by entering the following at the command prompt (assuming your user name is “pi”) and pressing Enter:
pi@raspberrypi ~ $ sudo adduser pi i2c_
Now it's time to power down your Raspberry Pi and plug the ADC Pi module into the GPIO header.
After you reboot your Raspberry Pi, enter the following at the command line prompt and press Enter:
pi@raspberrypi ~ $ i2cdetect -y 1_
This should detect the presence of the ADC Pi module and display the address of the i2c bus as shown below.
The ADC Pi module uses the Quick2Wire library to allow easy access to the I2C port from Python 3. You need to download and install the Quick2Wire library, but first you need to download and install Setuptools.
Download the most up-to-date version of Setuptools (currently v1.1.6) from the Python website. Extract the “.tar.gz” package, go to the folder called “/setuptools-1.1.6” and enter the following at the command line prompt and press Enter:
.../setuptools-1.1.6 $ sudo python3 ez_setup.py_
Now download the Quick2Wire Python API package from GitHub. Extract the ".zip" file, go to the folder called “/quick2wire-python-api-master” and enter the following at the command line prompt and press Enter:
.../quick2wire-python-api-master $ sudo python3 setup.py install_
Download the "adcpiv2" sample code from GitHub. Launch IDLE3 and open the file "adcpiv2.py" and run it by selecting "Run->Run Module (or by pressing "F5"). The program continually takes readings from channel 1 on the ADC Pi module and displays the results on the Python Shell window. The results shown in the screenshot below were obtained by connecting a “AA” battery to the input of channel 1 on the ADC Pi module while the program was running.
Congratulations! You've just made the world's most complex battery tester! You can stop the program running by pressing "Ctrl + C" when the Python Shell window is active.
So now we have a Raspberry Pi capable of generating an RF signal (see my previous post) and measuring an analogue DC signal. The final part of hardware required for the Raspberry Pi Wobbulator is some sort of detector to convert the RF coming out of the circuit under test into an analogue DC signal. That will be the subject of my next post.
Subscribe to:
Posts (Atom)