• Electrical Engineering V3
    3,104 replies, posted
My university coursework involves making two raspberry pis talk over serial. Not too bad until the bit where they say we can't use the inbuilt serial and instead we have to design our own using a C++ program to control the GPIO pins. After quite a lot of stress I can now send 64 bit commands reliably but only at about 5 commands/sec :suicide:
So I salvaged some old CCTV stuff and out of the pile I ended up with one camera unit with a 410K pixel (AKA: nothing all that spectacular) camera, automatic iris, 4-9mm manual zoom lens and a pan/tilt mount. There was also an outdoor wallmount but the dome is missing. I thought this would make for a great webcam up on the roof with the antennas. [img]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7531.jpg[/img] [img]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7532.jpg[/img] The +12v and composite out are fairly straightforward but controlling the mount is another story. There's still six other wires I have no idea what they do. The unit has no branding but only a model: Y1-PAN. No documentation or mention of it exists on the internet so odds are it's from fly-by-night Chinese company #33123495. [img]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7533.jpg[/img] [img]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/Y1-PAN.png[/img] This is what the wire harness breaks out to end-to-end. Again the video and power lines are obvious. It seems that the standard for PTZ control is to use RS-485 but I can't confirm if that is a 2-wire or 4-wire system. Any idea on where to start experimenting before I jam wires into my DVR and see what combination makes it move? (or blow up the RS-485 driver)
Just found an old Cisco Router PSU (Which I think I previously salvaged while working for another company) which has everything marked out nicely on the board. But I am no expert sooo : It looks shows the following markings : [B]12v [/B]= 12v line [B]GND [/B]= Ground [B]Status_1 [/B]= ? [B]Status_2 [/B]= ? [B]PG [/B]= Power Good ?? [B]RPS_PRES [/B]= ? [B]-48V[/B] = -48V line [B]-48VRTN[/B] = ? Can anybody help me identify these, I will make a clear picture tomorrow (its night now here) and see if it does anything without any mods. But I figured I could at-least post this before plugging it in. Also the PSU model is a LITEON PA-2461-1A
[QUOTE=quincy18;52099816]Just found an old Cisco Router PSU (Which I think I previously salvaged while working for another company) which has everything marked out nicely on the board. But I am no expert sooo : It looks shows the following markings : [B]12v [/B]= 12v line [B]GND [/B]= Ground [B]Status_1 [/B]= ? [B]Status_2 [/B]= ? [B]PG [/B]= Power Good ?? [B]RPS_PRES [/B]= ? [B]-48V[/B] = -48V line [B]-48VRTN[/B] = ? Can anybody help me identify these, I will make a clear picture tomorrow (its night now here) and see if it does anything without any mods. But I figured I could at-least post this before plugging it in. Also the PSU model is a LITEON PA-2461-1A[/QUOTE] I dont understand the question. Before you plug it in where? What are you trying to do?
[QUOTE=elitehakor;52003085]hi anyone want to help me figure out what the heque this signal is [img]https://dl.dropboxusercontent.com/u/5168294/screencaps/Screenshot%202017-03-23%2020.41.56.png[/img] and how i could replicate it while being able to change the frequency of it easily? thx[/QUOTE] finally was able to measure the signal. just a standard pwm [t]https://dl.dropboxusercontent.com/u/5168294/screencaps/20%20mph%3F.png[/t]
[QUOTE=elitehakor;52099902]finally was able to measure the signal. just a standard pwm [t]https://dl.dropboxusercontent.com/u/5168294/screencaps/20%20mph%3F.png[/t][/QUOTE] :mysterysolved:
also check out this dope filter my circuits group built [t]https://dl.dropboxusercontent.com/u/5168294/irl%20pictures/2017-04-12%2020.47.56.jpg[/t] beautiful ennit [editline]13th April 2017[/editline] the cylinder caps are placeholders because we found out we can't use them for filters iirc
[QUOTE=AGMadsAG;52099840]I dont understand the question. Before you plug it in where? What are you trying to do?[/QUOTE] I'm sorry I should have been clearer, I want to use it as a temporary bench supply for some experimentation. So I need to be able to start it without the router I salvaged it from. Knowing what the pins are is just for making it look good / actually using it for something productive depending on what it represents. Like I said maybe it works straight out of the box, but I have done a ATX power supply and a Dell Server PSU conversion before and most of the time you need to give it some sort of oke signal. I can't test it right now but I thought I could at least post the markings.
[QUOTE=pentium;52096738]So I salvaged some old CCTV stuff and out of the pile I ended up with one camera unit with a 410K pixel (AKA: nothing all that spectacular) camera, automatic iris, 4-9mm manual zoom lens and a pan/tilt mount. There was also an outdoor wallmount but the dome is missing. I thought this would make for a great webcam up on the roof with the antennas. [t]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7531.jpg[/t] [t]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7532.jpg[/t] The +12v and composite out are fairly straightforward but controlling the mount is another story. There's still six other wires I have no idea what they do. The unit has no branding but only a model: Y1-PAN. No documentation or mention of it exists on the internet so odds are it's from fly-by-night Chinese company #33123495. [t]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7533.jpg[/t] [t]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/Y1-PAN.png[/t] This is what the wire harness breaks out to end-to-end. Again the video and power lines are obvious. It seems that the standard for PTZ control is to use RS-485 but I can't confirm if that is a 2-wire or 4-wire system. Any idea on where to start experimenting before I jam wires into my DVR and see what combination makes it move? (or blow up the RS-485 driver)[/QUOTE] I'd look and see if there's any datasheets for the ICs, and see if there's any motor drivers onboard. If you can't reverse-engineer the signals to make it move specifically (which might be impossible since you don't have the complete control package to reverse-engineer), you may end up having to by-pass the motor control inputs and use your own microcontroller to do whatever you want.
Does anyone know of any good replacements for a MC3PHAC motor control IC? I had come across it in a blog and read its datasheet and it was well suited for my project, but the fact that it's discontinued and that you can't find it [I]anywhere[/I] is making me feel salty.
[QUOTE=Sombrero;52110578]Does anyone know of any good replacements for a MC3PHAC motor control IC? I had come across it in a blog and read its datasheet and it was well suited for my project, but the fact that it's discontinued and that you can't find it [I]anywhere[/I] is making me feel salty.[/QUOTE] IIRC, there's no direct replacement for it. I had a mate looking for some a while back and that's the only consensus we came to. He ended up just programming some micro-controllers for his specific need, I could send him a message seeing if he's still got the info on what he did.
Does Invensense not release datasheets for their products? Spotted [URL="https://www.digikey.com.au/product-detail/en/invensense/ICM-20648/1428-1061-1-ND/5872876"]this shiny little thing[/URL] on digikey, which comes with approximately 0 relevant documentation...
[QUOTE=NeonpieDFTBA;52096030]My university coursework involves making two raspberry pis talk over serial. Not too bad until the bit where they say we can't use the inbuilt serial and instead we have to design our own using a C++ program to control the GPIO pins. After quite a lot of stress I can now send 64 bit commands reliably but only at about 5 commands/sec :suicide:[/QUOTE] Update: free drawing a simple line is around 1000 commands or 4 minutes of transmission right now. Think i might need to find a way of reducing that :v:
[QUOTE=iwancoppa;52111985]Does Invensense not release datasheets for their products? Spotted [URL="https://www.digikey.com.au/product-detail/en/invensense/ICM-20648/1428-1061-1-ND/5872876"]this shiny little thing[/URL] on digikey, which comes with approximately 0 relevant documentation...[/QUOTE] Good lord, and $106 for the breakout board, too. :dogwow: Also, [url=https://store.invensense.com/datasheets/invensense/ICM-20648_ProductSpec_V1.0.PDF]literally the first result on Google.[/url] [url=https://www.invensense.com/products/motion-tracking/6-axis/icm-20648/]The official website also has all the register information.[/url]
I got stuff yesterday! [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7536.jpg[/IMG] [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7537.jpg[/IMG] That pocket microscope is kinda cool I guess. The optical zoom is pretty good. [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/PICT0001.jpg[/IMG] [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/PICT0003.jpg[/IMG] ...but otherwise the guts are a cheap chinese dashcam. It boots the same way and has the same setup menus as the camera in my car. Also got some tubes and LED's but otherwise held back on more because I already got a shed full of gear from the last two years. :v
Figured out how to control that PTZ camera. Protocol: Pelco-D Baud rate: 2400BPS [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7540.jpg[/IMG]
[QUOTE=F.X Clampazzo;52110617]IIRC, there's no direct replacement for it. I had a mate looking for some a while back and that's the only consensus we came to. He ended up just programming some micro-controllers for his specific need, I could send him a message seeing if he's still got the info on what he did.[/QUOTE] I'll just have to do it in the code myself, not too much of a problem. I'm going to place an isolated basic dual driver with built in deadtime ahead of a protected driver in case a bug short circuits the deadtime logic in my code. Oh, and got this nice beafy liquid (might try refrigerant) cooled heatsink in today. This thing is like a lead brick trying to lift it. -large pic warning- [t]http://i.imgur.com/JOgARu6.jpg[/t]
[QUOTE=Sombrero;52122066]I'll just have to do it in the code myself, not too much of a problem. I'm going to place an isolated basic dual driver with built in deadtime ahead of a protected driver in case a bug short circuits the deadtime logic in my code. Oh, and got this nice beafy liquid (might try refrigerant) cooled heatsink in today. This thing is like a lead brick trying to lift it. -large pic warning- [t]http://i.imgur.com/JOgARu6.jpg[/t][/QUOTE] If it's meant for liquid, best to stick with liquid. Copper for refrigeration is a tougher grade than that meant for water (K and L vs. M), and the softer grades meant for liquids and plumbing in general aren't meant to hold up to the pressures present in refrigerated systems.
[t]http://i.imgur.com/iDBIS65.jpg[/t] Here is a fine example of quality Panasonic engineering, switching transistors pressed down on to the PCB with no heatsink and no thermal paste, it's been overheating like that for quite a few years.
[QUOTE=Sombrero;52122066]I'll just have to do it in the code myself, not too much of a problem. I'm going to place an isolated basic dual driver with built in deadtime ahead of a protected driver in case a bug short circuits the deadtime logic in my code. Oh, and got this nice beafy liquid (might try refrigerant) cooled heatsink in today. This thing is like a lead brick trying to lift it. -large pic warning- [t]http://i.imgur.com/JOgARu6.jpg[/t][/QUOTE] [QUOTE=Zero-Point;52122541]If it's meant for liquid, best to stick with liquid. Copper for refrigeration is a tougher grade than that meant for water (K and L vs. M), and the softer grades meant for liquids and plumbing in general aren't meant to hold up to the pressures present in refrigerated systems.[/QUOTE] Plus its usually easier to design for considering most cold plates like these (I recognize that as an Ohmite cold plate, we use them at work) already have thermal resistance specs for water at different flow rates (usually gallons/min). Trust me its leagues easier to just use the straightforward °C/W thermal resistance rating with water than to do the thermal modeling yourself.
[QUOTE=LoneWolf_Recon;52122850]Plus its usually easier to design for considering most cold plates like these (I recognize that as an Ohmite cold plate, we use them at work) already have thermal resistance specs for water at different flow rates (usually gallons/min). Trust me its leagues easier to just use the straightforward °C/W thermal resistance rating with water than to do the thermal modeling yourself.[/QUOTE] I've got the datasheet [URL="http://www.mouser.com/ds/2/2/Hi-Contact_6-Pass_Datasheet_January2016_A01-908218.pdf"]here[/URL]. And that copper is 3/8 OD and 1.4mm wall which is considerably thick. If refrigerant doesn't work, I'll just use a water chiller system.
[QUOTE=pentium;52118324]Figured out how to control that PTZ camera. Protocol: Pelco-D Baud rate: 2400BPS [IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7540.jpg[/IMG][/QUOTE] Look-at-this-crazy-man cam
[QUOTE=Sombrero;52123136]I've got the datasheet [URL="http://www.mouser.com/ds/2/2/Hi-Contact_6-Pass_Datasheet_January2016_A01-908218.pdf"]here[/URL]. And that copper is 3/8 OD and 1.4mm wall which is considerably thick. If refrigerant doesn't work, I'll just use a water chiller system.[/QUOTE] The important thing to note is that thickness isn't as important as malleability when it comes to refrigeration copper. They can get away with such thin walls for refrigeration copper (in the coils anyway) because it's much tougher stuff. But if you do try it, please tell me you're educated in proper brazing technique and materials. I've personally witnessed horrifying installations where they used [I]plumbing solder[/I] on refrigeration installations and it ain't pretty/safe.
[QUOTE=Zero-Point;52125061]The important thing to note is that thickness isn't as important as malleability when it comes to refrigeration copper. They can get away with such thin walls for refrigeration copper (in the coils anyway) because it's much tougher stuff. But if you do try it, please tell me you're educated in proper brazing technique and materials. I've personally witnessed horrifying installations where they used [I]plumbing solder[/I] on refrigeration installations and it ain't pretty/safe.[/QUOTE] Is that due to plumbing solder just having poor gas/vapor sealing properties? Ala shit outgassing? Or just due to it unable to hold under the pressure?
[QUOTE=LoneWolf_Recon;52125152]Is that due to plumbing solder just having poor gas/vapor sealing properties? Ala shit outgassing? Or just due to it unable to hold under the pressure?[/QUOTE] Plumbing solder isn't meant for that sort of pressure, it's much too soft. You can easily make sharp bends in plumbing solder to fit hard-to-reach places with your bare hands, you [I]need[/I] pliers to do the same with Silfos brazing rod. Silver solders [I]could[/I] be used, and don't require as much heat as brazing with Silfos, but tin/antimony (plumbing) solder doesn't have the strength. But when I worked HVAC we always used Silfos for a few reasons: 1) It's tough as shit. 2) The high-ish silver content (15%) helps it flow into the joint to ensure a good seal (30% would be better for this but more expensive, though I did find a couple of sticks on a rooftop once. Yoink!) 3) Silfos is self-fluxing, meaning you don't really need any joint prep unless the copper is already heavily oxidized. Softer solders are also more prone to damage from the typical vibrations you'd encounter in an HVAC system.
[QUOTE=Zero-Point;52125288]Plumbing solder isn't meant for that sort of pressure, it's much too soft. You can easily make sharp bends in plumbing solder to fit hard-to-reach places with your bare hands, you [I]need[/I] pliers to do the same with Silfos brazing rod. Silver solders [I]could[/I] be used, and don't require as much heat as brazing with Silfos, but tin/antimony (plumbing) solder doesn't have the strength. But when I worked HVAC we always used Silfos for a few reasons: 1) It's tough as shit. 2) The high-ish silver content (15%) helps it flow into the joint to ensure a good seal (30% would be better for this but more expensive, though I did find a couple of sticks on a rooftop once. Yoink!) 3) Silfos is self-fluxing, meaning you don't really need any joint prep unless the copper is already heavily oxidized. Softer solders are also more prone to damage from the typical vibrations you'd encounter in an HVAC system.[/QUOTE] I've helped braze up the piping for a gas delivery system in a metal shop. We also used 30% silver content brazing rods with flux core, except for oxygen, that requires special care so I wasn't doing it as a temp guy.
Im writing an RDS demodulator / decoder that takes an FM signal, processes it down to the MX signal and extracts the RDS signal. I was so convinced I was doing something wrong as my output data didn't match what I would expect. Turns out I managed to record the one station in my area that didn't conform to the PI code standards :v: Every other station correctly declares it's country and program number expect the one I recorded.
[QUOTE=Dolton;52136928]Im writing an RDS demodulator / decoder that takes an FM signal, processes it down to the MX signal and extracts the RDS signal. I was so convinced I was doing something wrong as my output data didn't match what I would expect. Turns out I managed to record the one station in my area that didn't conform to the PI code standards :v: Every other station correctly declares it's country and program number expect the one I recorded.[/QUOTE] Do you have a github for this? I'm interested in reading it, RDS is beyond me.
[QUOTE=LoneWolf_Recon;52136940]Do you have a github for this? I'm interested in reading it, RDS is beyond me.[/QUOTE] I don't have a github repo set up currently as it is just MATLAB code but I'll post it below. Mind you that this is only for decoding the FM air signal down to the RDS bits. I use gr-rds to pull out framing information but RDS is simple enough that you can quickly look at the frames and decode it with the standard up in another tab. This code is very WIP and doesn't do everything exactly "right". For example I don't have any clock phase sync right now and just manual adjust it. I am planning to switch to a PLL style timing recovery but the code I already wrote for that is on a laptop I don't have access to at the moment. Still, it works and plots a shit tonne of signals at various stages of decoding. [CODE]% Andrew Cragg 2017 % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. %% Perform clean up clc clear clf close all clear sound %% Import Data [in_data_seq, in_fs_seq] = audioread('21-17-43_106100kHz.wav'); % Convert to complex IQ data in_fs = in_fs_seq; in_data_c = (in_data_seq(:,1) + 1i*in_data_seq(:,2))'; %% FM Processing % Perform FM Demod down to MX using atan2 method % Note: atan2 has poor performance and doesn't translate well to FPGA's mx_data = diff(unwrap(angle([in_data_c 0]))); % Plot MX spectrum % Generate f range f0 = (-.5:1/length(in_data_c):.5-1/length(in_data_c)) * in_fs; figure(1) plot(f0, 10*log10(abs(fftshift(fft(mx_data))))) % Generate Single Sided FIR Filter num_taps = 4096*2; upper_lim = 19200; lower_lim = 18800; freq_range = 1:num_taps; fxlating_ft = and((freq_range > num_taps * (lower_lim / in_fs)),(freq_range < num_taps * (upper_lim / in_fs))); fxlating_taps = hamming(num_taps)' .* ifftshift((ifft((fxlating_ft)))); figure(2) freqz(fxlating_taps,1) %% Filtering % Filter out the 19Khz pilot tone tic pilot_tone = fftfilt(fxlating_taps, mx_data, length(mx_data)); pilot_tone = fftfilt(fxlating_taps, pilot_tone, length(pilot_tone)); three_pilot_tone = pilot_tone .* pilot_tone .* pilot_tone; toc % Plotting figure(3) plot(f0, 10*log10(abs(fftshift(fft(pilot_tone))))) figure(4) plot(diff(unwrap(angle(three_pilot_tone(20000:54000)))), 'x'); % Down Converting tic down_mix = mx_data .* three_pilot_tone; toc figure(5) plot(f0, 10*log10(abs(fftshift(fft(down_mix))))) grid on % Baseband filtering num_butter_taps = 9; [base_fir_taps, base_iir_taps] = butter(num_butter_taps, 4800 / in_fs, 'low'); tic baseband = filter(base_fir_taps, base_iir_taps, down_mix); toc figure(6) plot(f0, 10*log10(abs(fftshift(fft(baseband))))) %% Baseband Processing % RRC Shaping and resampling [p, q] = rat(57*3/((in_fs)/1000)); tic baseband_resample = resample(baseband(144*50:end), p, q); toc % Root Raised Cosine Matched Filter % 144 Samples Per Symbol % 171K samples/second / 144 samples/symbol % 1.1875 symbols / second % Excess bandwidth of 1.0f sps = 144; span = 16; fd_norm = (1187.5 / (171000)); f_lp = -.5:1/(span*sps):.5; ht_lp_mask = (abs(f_lp) < 2 * (fd_norm)); ht_lp = ht_lp_mask .* cos(pi*f_lp*(1/fd_norm)/4); ht_lp_taps = real(ifftshift(ifft(fftshift(ht_lp)))); ht_lp_taps = ht_lp_taps / sum(abs(ht_lp_taps)); ht_lp_taps1 = -ht_lp_taps(1:end-sps/2) + ht_lp_taps(1+(sps/2):end); ht_taps_current = ht_lp_taps; % DEBUG: Test code, ignore % ht_lp_taps1 = ht_lp_taps(1:end-sps/2) - ht_lp_taps(1+(sps/2):end); % plot(abs((fft(ht_lp_taps1)))) % hold on % plot(abs((fft(rc0)))) % hold off % Perform matched filtering on input % tic % baseband_ht = conv(baseband_resample, ht_lp_taps, 'same'); % toc % Perform matched filtering on input % Uses FFT method instead of convolution tic baseband_ht = fftfilt(ht_taps_current, baseband_resample, length(baseband_resample)); toc % DEBUG: Test code, ignore % baseband_rrc0 = conv(baseband_resample, rc0, 'same'); % baseband_rrc = conv(baseband_resample, rc, 'same'); %baseband_ht = baseband_ht(144*26000:end); % Plot sample of matched filter output figure(7) %plot(angle(resample(baseband_ht(i+length(ht_taps_current/2)+i:end),1,72)),'x') plot((angle(baseband_ht(100000:140000)))) grid on % Plot spectrum of matched filter output figure(8) plot(10*log10(abs(fftshift(fft(baseband_ht))))) % Hackish temporary replacement for true symbol timing for i = 1:48*3 temp_symbols = baseband_ht(i+length(ht_taps_current/2):48*3:end); % Comment this out unless you want to visually see symbol offsset timing % effects in action. Uses pause so press any key to advance symbol % sample time by one sample % figure(9) % plot(((temp_symbols(100:1:end))), 'x') % axis('equal') % grid on % pause % disp(num2str(i)) end %% Pay no attention rn, testing % VERY hackish way to plot RDS data % Find i offset value through trial and error to minimize % BPSK constellation size. Not true symbol timing but % it works if your radio has good frequency acuracy as the % symbol timing is tied to the pilot tone. Small freqeuncy offsets % i.e 2Hz will only move the symbol timing ~2 samples per second % of recorded data. For short burts this doesn't really matter % TODO: Implement real symbol timing from previous project. % This will use Gardner timing recovery which looks at zero crossings % Which biphased data guarantee i = 114; symbol_unaligned = baseband_ht(i+length(ht_taps_current/2):48*3:end); % Uncomment this after running through once to see % the same data demodulated using the regenerated clock signal % derived from the 19KHz pilot tone % symbol_unaligned = (bits_test(1:2:end-1) + (bits_test(2:2:end) .* exp(sqrt(-1)*pi))) / 2; ave_angle = sum(angle(symbol_unaligned)) / length(symbol_unaligned); symbol = symbol_unaligned .* exp(-sqrt(-1)*ave_angle); % Take every other sample. To symplify things we have purposfly used half % the true sample rate. This lets us treat biphase data as a simply BPSK % data and look at either the leading or trailing part of the biphase data % and since it is differentially encoded we don't care which one symbol = symbol(1:1:end) / (sum(abs(symbol)) / length(symbol)); eb = (sign(angle(symbol)) + 1) / 2; ebd = abs(eb(2:end) - eb(1:end-1)); % Plot the new symbol constellation figure(10) subplot(2,1,1) plot(symbol, 'x') title('BPSK Constellation') axis('equal') grid on subplot(2,1,2) plot(angle(symbol)/pi, 'x') grid on % Stats on the signal signal_center = (abs(abs(symbol) - mean(abs(symbol)))); spow = (sum(signal_center .* signal_center) / length(symbol)); SNR = 10*log10(1/spow) % A bunch of bullshit plotting and whatnot for n = 1:8 ebc = ebd(n:end); bytenum = floor(length(ebc)/8); bits = zeros(bytenum, 8); for k = 1:8 bits(:,k) = ebc(k:8:end-((length(ebc) - floor(length(ebc)/8)*8))); end ch = bin2dec(num2str(bits)); disp(char(ch')) end % Block correlation over 104 bit period or 87.6ms figure(11) plot(xcorr(2*ebd-1, 2*ebd-1)) title('Bit stream autocorrelation') % Plot the RDS frames. 104 bits per frame % 4 frames per block ebr = reshape(ebd(1:104 *(floor(length(ebd) / 104))), 104, []); figure(12) image(ebr'*255) title('RDS Data Frames') % ASCII file writting % f = fopen('outbits.bin', 'w') % fwrite(f, ebd + 48, 'int8'); % fclose(f) %% Clock recovery testing pilot_sq = sign(real(resample(pilot_tone, p,q))); clk_state = 0; cnt = 0; symbol_clk = zeros(1, length(pilot_sq)); for n = 2:length(pilot_sq) if((pilot_sq(n) ~= pilot_sq(n-1)) && (pilot_sq(n) > 0)) cnt = cnt + 1; end if(cnt == 8) clk_state = xor(clk_state,1); cnt = 0; end symbol_clk(n) = clk_state; end %% Plotting figure(13) le = 555000; plot((symbol_clk(100:le) - .5) * 6) hold on for n = 102:length(symbol_clk(100:le)) if((symbol_clk(n) ~= symbol_clk(n-1)) && (symbol_clk(n) > 0)) plot([n-1, n]-99, ([symbol_clk(n-1), symbol_clk(n)] - .5) * 6, 'r') end end bits_test_raw = zeros(1, ceil(length(symbol_clk(100:le)) / 72) - 1); co = 1; for n = 102:length(symbol_clk(100:le)) if((symbol_clk(n) ~= symbol_clk(n-1))) plot(n-99, (angle(baseband_ht(n))), 'kx') bits_test_raw(co) = (baseband_ht(n)); co = co + 1; end end plot((angle(baseband_ht(100:le ))), 'b') plot(imag(baseband_ht(100:le )) / ((sum(abs(baseband_ht(100:le )))) / length(baseband_ht(100:le )))) for n = 102:length(symbol_clk(100:le)) if((sign(imag(baseband_ht(n))) ~= sign(imag(baseband_ht(n-1))))) plot([n+36]-99, ([angle(baseband_ht(n+36))]), 'mx') end end grid on hold off bits_test_raw = bits_test_raw / (sum(abs(bits_test_raw)) / length(bits_test_raw)); bits_test = bits_test_raw(100:end); figure(14) subplot(1,2,1) plot((bits_test), 'bx') axis([-2 2 -2 2]) grid on % plot(bits_test(1:2:end-1), 'rx') % plot(bits_test(2:2:end-1), 'mx') subplot(1,2,2) plot((bits_test(1:2:end-1) + (bits_test(2:2:end) .* exp(sqrt(-1)*pi))) / 2, 'kx') axis([-2 2 -2 2]) grid on % TEST % IGNORE tbits = sign(angle(bits_test(1:end).*exp(j*pi/4))/pi); sum(abs(tbits(1:2:end-1) + tbits(2:2:end))) sum(abs(tbits(2:2:end-1) + tbits(3:2:end)))[/CODE] [editline]24th April 2017[/editline] [URL="]https://filehost.net/638b7ed8949ebb06"]]Here is the captured signal I use. It is IQ sampled at 300Ksps and is complex data.[/URL]
[IMG]http://i11.photobucket.com/albums/a166/ballsandy/New%20Bucket/CGS_7541.jpg[/IMG] I mean, if it works, it works....right? v:v:v [sp]Proper adapters are on order but they'll be at least a month.[/sp]
Sorry, you need to Log In to post a reply to this thread.