Sorry, I don't know Visual Basic; but maybe you can try to just rewrite the code using VB instructions. Actually most of them are low level and compatible with other languages. Perhaps someone here knows VB and can do that.
You seem to want to have your custom solution and in that case you need to write your own code. If you use Processing it will allow you to log the data directly either into a .txt file or a .csv (comma separated values) file which you can open with Excel. Its really easy and there are examples out there. Processing has a powerful instruction (PrintWriter) that allows you to do that really easily. The only problem is that you can't do the graph in real time if you log the data into Excel (or I don't know how to do that yet). After the data is logged in, then you have to manually set the graph in excel. I have done it and works just fine.
-Send the data from Arduino to Processing using the Serial communication library. There are tons of examples out there. -Write the data into a .txt file or .csv if you want to use Excel and all its possibilities. For that you use PrintWriter. PrintWriter datalogger; datalogger=createWriter("datalogger.csv");(If no path is specified it will create the file in the sketch data file. If not, in the folder you specifiy the path for) datalogger.println( data1, data2, data3,....,dataN); (writes data into different contiguous excel cells). datalogger.println(); leaves a blank line of cells (not filled with data whenever you want). datalogger.println(moredata, evenmoredata, extradata); -Flush the data every once in a while in your code (on every Procesing loop or so). datalogger.flush(); -Close the .txt file or .csv file at exit. datalogger.close(); exit();
You can use the same thing with a .txt file; but to read the data back and make graphs will be a bit more complicated requiring loadStrings() into arrays and convertions to float(string);
If you want multiple files simply use arrays, like this:
I would use a trial and error approach increasing complexity only whenever is necessary. - First set up a simple system using a photo transistor as a detector (if you can find one sensitive to the wavelength you are using). They are normally more sensitive than photodiodes. If not, then try the photodiode.
-I would bias the diode or phototransistor and try to read the voltage output. You can set up a Wheastone Bridge configuration with a fix voltage divider on one side and the biased photodivice on the other. That allows you to cancel the bias voltage by using a differential amplifier without the need for an coupling AC capacitor. To set up your Diff Amp you don't need a special OpAmp for that trial as the frequency is low, the slew rate is low and the output impedance of the configuration is also low. You can try to use a regular LM324. In the datasheet you will find the Instrumentation Amp you can build with it and how to calculate the gain, etc. -With that rig already built, perform some tests and find out what you get at the output when you change the variable. From the results you will get enough info to make the necessary corrections to achive what you want in terms of sensitivity, etc.
Use 2 Graphite Rods. Place each in opposite arms of a Wheastone Bridge and then feed the output of the Bridge to an Instrumentation Amplifier (Differential Amp). Using 2 rods in opposite arms will double the sensitivity of the system. Make sure your diff amp output presents only positive voltages from 0V-5V to the Arduino analog input. For that you need to place the rods in the bridge arms where they produce a positive voltage output when the temp goes above 0 Celsius which is your min. That depends on the way the temp affects the resistance of the rods, that is, decreasing or increasing it (you probably found that already, I don't know; but probably increases with temp) Set the amplification (gain) of the diff amp so you will get close to 4V or 5V when the temp reaches your max (1500 Celsius giving some margin to avoid saturation of the Amp in worse case scenarios). When the system is set up then make a test run using a reference thermometer for calibration (an IR thermometer will be a good choice). Then feed the samples you obtain and the reference temp values into excel and make a graph. In the options select trend line and show equation. That will give you the resistance variation equation vs temp. With the equation you can linearize the curve in the arduino code or the computer code if you are sending the samples to the computer for Processing and analysis. You will also need to implement a digital low pass filter. Go for the moving average filter type so you don't need to average 1000 samples.
This is a Weather Station configured for Indoor Climate monitoring built with Processing 1.5.1 and Arduino UNO. At this time 3 pots connected to 3 Arduino analog inputs simulate the sensors. It should be easy to connect real sensors to monitor the variables and reset the mapping functions in the Arduino code. Most of today's sensors already contain amplifiers and the necessary signal conditioning electronics. The System can easily be reconfigured to monitor many other variables by just changing the sensors and reconfiguring the Gauges by simply changing the units of measurement and the scale parameters. The mapping functions should take care of the differences in scaling. At this point it is ready to accept analog sensors. If digital ones are used, the Arduino code must be modified to read the I2C signals.The 10 bits resolution of the Arduino ADC is maintained and 10 bits (0-1023) samples are sent to the computer in 2 bytes not to affect the resolution. Needle Inertia was implemented by a strong digital low pass filter in the Processing code. I'm already working in a version including a 3 channel recorder, but it will take a while as my time is very limited and that's the hardest part to build.
Thanks for the info. I begin to get the whole idea better now.
-Both transducers can be running at the same time; but if so, they should not be placed at the same time on the sample otherwise there maybe some cross talking and you will be picking up both signals at the receivers.
-Circuits grounds should be connected together. That is, your scope and pulse generator grounds should be common. External Inputs are not for that, they are used to trigger the units, do not connect them. In other words, the BNC connectors grounds on both units should be connected, so the circuit has a common ground. If they are not connected now, that maybe the reason why you are reading only 5V instead of the 400v as the current path is not the units' ground and there is a huge voltage loss in the link. CAUTION: If you find now that their grounds are not connected together, do not connect them as this may cause the voltage to go up to 400V at the scope input and damage it.
-I like your idea. Drive both TXs together by splitting the pulse generator signal and switch the RXs signals which are low voltage. CAUTION: when you split the signal the power you are suppliying to the TXs may decrease as you are increasing the load to the pulse generator and causing impedance mismatch. You need to try and see if the difference is acceptable or not.
-To switch the RXs signals you can built a metal box where you place 3 BNC connectors. 2 on one side and another in the opposite side. Inside the box you place your relay STDP (center contact switches to either one of the to ends). You connect your RXs signals to the 2 BNCs on one side and the scope input to the other BNC in the other side. The relay when activated switches the signal from either Rxs to the scope input. Place another low voltage jack to supply power and commutation signal to the relay. Seal the box. At 3MHz there should not be a problem with interference. You need to test and see the results. The good thing is that you are already familiar with what happens without this rig so you will be able to notice if there is any difference. Activate the relay from Arduino at 2 Hz square wave and check the results. You can easily change the pulses freq and duty cycle in the Arduino code to get the best results. You will get some noise when the relay switches; but that will quickly disappear and you will still have time enough to see the useful signal you want. It all depends on how fast the switching is done. The relay contacts once they close they should not affect signal transmission at 3MHz. Again trial and error until you get what you want.
-Built another metal box and set an attenuator using 2 simple resistors dividing the pulse generator voltage by 10. Feed the attenuated signal to the scope other input so you can have the Tx reference signal in the screen at all times to make the comparison with the received ones. The scope should work fine with 40V at the input.
Post here if you need more help. Also good if you post how it progresses . Good luck.
Sorry, you need to provide more info in order to help you.
-What scope are you using?. -1 second is the switching signal period you are willing to have or its ON state? In other words, what's the frequency and duty cycle you want for your switching signal? -When you mentioned 2 pairs, I guess is 4 coax cables and you want to switch 2 at a time to the scope 2 Channels inputs. Is that correct? -If that's the case, are all 4 wires carrying 400V pulses? or is 2 TXs and 2 RXs? -What's the pulse repetition freq (PRF) of the signal?. -If you make a drawing of the set up you want that would help.
-If you use relays, the bouncing on the contacts will introduce noise. If the switching is done too fast, as your ON/OFF time gets closer to the duration of the bouncing the signal to noise ratio will be greatly deteriorated. -If you switch 400V directly with relays there will probably be sparking in the contacts and you may need special HV relays to extend their life. Besides that you are risking damaging the scope input with such a HV.
I'm thinking of building a THD measurement device for the AC mains line (110VAC). I have very little experience in power circuits and have no idea what the typical THD values for a regular house line could be. I can always go for up to 100% in the scale; but I don't think it will get even close to that in worst case real scenarios, so that will deteriorate the instrument's resolution. Any ideas of the typical range??? Also, can I sample the 60Hz fast enough with Arduino and get multiple samples for one cycle? How many sample do you think I can get per cycle using Arduino?
You have given very little info on the set up you are attempting; but anyway I think you should avoid connecting the 400V pulses directly to the scope input. You can set simple attenuators using voltage dividers (let's say by 1/100) to work with a safe voltage at the scope input and if required, you can switch those signals safer using low voltage devices. The scope will work nicely with 4V at the input. Maybe you should use opto-couplers to send the commands from Arduino to the switching devices if you choose solid state ones. In that way, Arduino will be safe in case of HV failure. I think, the switching freq you are using is too high for conventional coil relays.