Tag Archives: Arduino
Since I’m not an electrical engineer and they teach nothing about oscilloscopes in traffic engineering classes, I’ve been viewing lots of videos about using scopes on YouTube. After seeing W2AEW’s video, I thought I’d get an Arduino and make a “poor man’s TDR” (as he calls it) by having the Arduino output pulses.
This is really quite simple. Too simple.
So simple it didn’t work.
Initially, it looked pretty good. I don’t know about the accuracy of the Arduino, but I imagine that it is good enough. The problem, I’m guessing, is the current. An Arduino is pretty limited (40 mA), so pushing it through a cable and expecting it to be able to act like the video might be pushing it.
Anyway, for the sake of showing, here’s what I did…
The Arduino Sketch
The Circuit
It’s pretty simple. Plug the scope probe into pin #7 and ground the scope probe ground to the Arduino.
The Results
Without any coax or with a ~6 foot piece of RG-58 open at the other end, I can see the step from the pulse. But when I connect a 50-ohm dummy load, the voltage drops.
Without a load:
With a load:
Note the difference in voltage between the two. I had the scope set to DC for these to keep the baseline the same, and the voltage per division was 1V.
Back to the drawing board.
-73-
On October 13, 2011, I presented An Introduction to Arduino Microcontrollers to my club, the Milford Amateur Radio Club. Below are links to help get started and other resources. I will be posting the sample projects and code in a separate blog post.
Arduino
Arduino Getting Started Resources
Arduino Getting Started: http://arduino.cc/en/Guide/HomePage
Arduino Language Reference: http://www.arduino.cc/en/Reference/HomePage
Arduino Inventors Guide:
http://www.sparkfun.com/tutorial/AIK/ARDX-EG-SPAR-PRINT-85-REV-10.pdf (print quality)
http://www.sparkfun.com/tutorial/AIK/ARDX-EG-SPAR-WEB-REV10.pdf (screen quality)
Oomlaut – http://www.oomlout.com/a/ (authors of Inventor’s Guide)
Arduino Suppliers
Sparkfun – http://www.sparkfun.com/
Also available in Micro Center Mall – in the Cincinnati (Sharonville) Micro Center, walk into the video games area and keep going straight!
Starter Kit: http://www.sparkfun.com/products/10174
Large Kit: http://www.sparkfun.com/products/10173
Adafruit Industries – http://www.adafruit.com/
Starter Kit: http://www.adafruit.com/products/68
Large Kit: http://www.adafruit.com/products/170
Arduino Ham Radio Projects
Trackuino APRS Arduino Open Source Code – http://code.google.com/p/trackuino/
Satellite Doppler Effect Rig Tuner – http://youtu.be/TP_fq_frqKw
Morse Code Keyboard – Gone off the net (was at http://gorsat.wordpress.com/2009/03/17/first-arduino-project-morse-code-keyboard/)
More Morse Code with Arduino – http://kb3vcq.posterous.com/arduino-morse
Microcontrolled Ham Radio – http://www.youtube.com/watch?v=0bca4yNgysw
Arduino AM Transmitter – http://dangerousprototypes.com/2011/10/05/am-sofware-radio-using-arduino/
WSPR Beacon – http://ko7m.blogspot.com/2011/03/wspr-beacon-with-arduino-and-dds-60.html
Arduino Antenna Tuner Controller – http://www.n3ox.net/projects/servo/
Other Noteworthy Projects
Other Cool Stuff and Blogs
Nuts & Volts – http://www.nutsvolts.com/
Hack A Day – http://hackaday.com/
Arduino Blog – http://arduino.cc/blog/
bildr Blog – http://bildr.org/
Tools
Google Code – http://code.google.com/ – code hosting – free for open source
GitHub – https://github.com/ – code hosting – free for open source
Example Sketches
Example #1: Blinking LED
#define LEDPIN 11 #define LSPIN 5 void setup() { pinMode(LEDPIN, OUTPUT); } void loop() { int lightlevel=analogRead(LSPIN); Serial.println(lightlevel); digitalWrite(LEDPIN,HIGH); delay(lightlevel); digitalWrite(LEDPIN,LOW); delay(lightlevel); }
Example 2: Temperature and Humidity on LCD
#include #include // Data wire is plugged into port 7 on the Arduino // Connect a 4.7K resistor between VCC and the data pin (strong pullup) #define DHT22_PIN 7 // Setup a DHT22 instance DHT22 myDHT22(DHT22_PIN); LiquidCrystal lcd(12,11,5,4,3,2); void setup() { lcd.begin(16,2); lcd.clear(); lcd.print("Starting..."); delay(2000); //Serial.begin(9600); } void loop() { DHT22_ERROR_t errorCode; errorCode = myDHT22.readData(); float tempC=0,tempF=0; lcd.clear(); delay(100); switch(errorCode) { case DHT_ERROR_NONE: tempC=myDHT22.getTemperatureC(); tempF=1.8*tempC+32; lcd.setCursor(0,0); lcd.print("Temp: "); lcd.print(tempF); lcd.print("F"); lcd.setCursor(0,1); lcd.print("Humidity: "); lcd.print(myDHT22.getHumidity()); lcd.print("%"); break; case DHT_ERROR_CHECKSUM: Serial.print(myDHT22.getTemperatureC()); lcd.setCursor(0,0); lcd.print("Temp: "); lcd.print(myDHT22.getTemperatureC()); lcd.print("C CSUM ERR"); lcd.setCursor(0,1); lcd.print("Humidity: "); lcd.print(myDHT22.getHumidity()); lcd.print("%"); break; case DHT_BUS_HUNG: lcd.setCursor(0,0); lcd.print("BUS Hung"); break; case DHT_ERROR_NOT_PRESENT: lcd.setCursor(0,0); lcd.print("Not Present"); break; case DHT_ERROR_ACK_TOO_LONG: lcd.setCursor(0,0); lcd.print("ACK time out"); break; case DHT_ERROR_SYNC_TIMEOUT: lcd.setCursor(0,0); lcd.print("Sync Timeout"); break; case DHT_ERROR_DATA_TIMEOUT: lcd.setCursor(0,0); lcd.print("Data Timeout"); break; case DHT_ERROR_TOOQUICK: lcd.setCursor(0,0); lcd.print("Polled too quick"); break; } delay(5000); }
It seems to me the way things are, the ways to run digital soundcard-based modes involves either a new rig and a new (enough) computer with a USB port. Or, you need an old computer with a serial port to trigger the push-to-talk (PTT).
My problem is that I have a MacBook Pro (no serial port) and an HTX-100 (no computer connectivity whatsoever and no VOX). While I can easily connect the mic and speaker to the computer, switching the PTT requires something to get a signal via USB (that something can read) and activate the PTT.
I did this via an Arduino Uno and a transistor and a rig.xml file. It was actually pretty simple, although I did have a little bit of trial-and-error with the rig.xml file.
In fldigi
The first thing to do is setup fldigi to communicate with the rig. This is done by putting the rig.xml file (Arduino.xml) in a good location, such as ~/.fldigi. The XML should look like below:
<!-- Rig definition file for use with fldigi --> <RIGDEF> <RIG>Arduino</RIG> <PROGRAMMER> Andrew Rohne AC8JO Tested by: AC8JO </PROGRAMMER> <STATUS> Tested Version: 1.00 Date: 1 Sept 2011 </STATUS> <TITLE>RigCAT - Arduino</TITLE> <!-- default settings for initial setup --> <TIMEOUT>0</TIMEOUT> <RETRIES>2</RETRIES> <WRITE_DELAY>0</WRITE_DELAY> <BAUDRATE>19200</BAUDRATE> <STOPBITS>1</STOPBITS> <DTRPLUS>false</DTRPLUS> <RTSPLUS>false</RTSPLUS> <DTRPTT>false</DTRPTT> <RTSPTT>false</RTSPTT> <RTSCTS>false</RTSCTS> <ECHO>false</ECHO> <CMDPTT>true</CMDPTT> <COMMAND> <SYMBOL>PTTON</SYMBOL> <SIZE>8</SIZE> <BYTES>FE</BYTES> </COMMAND> <COMMAND> <SYMBOL>PTTOFF</SYMBOL> <SIZE>8</SIZE> <BYTES>FD</BYTES> </COMMAND> </RIGDEF>
In fldigi, the setup in Configure – Rig control should be like below, but make sure the device is the correct address for the Arduino Uno. It will be the same address you use to upload the program to the Arduino.
Then, program the Arduino. The sketch is really simple as all it does is respond to the correct string from the serial input and turn on the LED and send some voltage to the transistor base. That allows current to go through the transistor and complete the circuit for the PTT switch. Basically, the transistor acts as a solid-state relay.
The Arduino sketch:
/* Arduino PTT Rig Interface Andrew Rohne, AC8JO 1Sep2011 */ int LedPort=2; int pttPort=3; void setup(){ Serial.begin(19200); pinMode(LedPort,OUTPUT); pinMode(pttPort,OUTPUT); digitalWrite(LedPort,HIGH); delay(100); digitalWrite(LedPort,LOW); delay(100); digitalWrite(LedPort,HIGH); delay(100); digitalWrite(LedPort,LOW); delay(500); digitalWrite(LedPort,HIGH); delay(100); digitalWrite(LedPort,LOW); delay(100); digitalWrite(LedPort,HIGH); delay(100); digitalWrite(LedPort,LOW); delay(500); } void loop(){ String tmp=Serial.read(); if(tmp=="254"){ digitalWrite(LedPort,HIGH); digitalWrite(pttPort,HIGH); }else if(tmp=="253"){ digitalWrite(LedPort,LOW); digitalWrite(pttPort,LOW); } }
As you can see from the sketch, most of the lines are to blink the LED (and this could be done with much fewer lines with two for loops).
The connection diagram is below. Obviously, I had to make a custom cable to go from the 8-pin round connector on my rig to the computer’s mic and phone jacks and the Arduino breadboard (well, breadboard for now).
The above works for me. I will be using it a lot and improving on it, but of you have any improvements, feel free to drop them in the comments.
UPDATE
The new version of Arduino (1.0) doesn’t wants line 33 of the sketch to be the following:
String tmp=(char*)Serial.read();
-73-