- Science Toys
- Magnetism
- Electromagnetism
- An electric motor in 10 minutes
- Fun with High Voltage
- Electrochemistry
- Radio
- Thermodynamics
- Aerodynamics
- Light and optics
- Biology
- Mathematics
- Computers and Electronics
You have the wrong com port selected. Com 3 does not work. It should say Com # Serial/USB. If there is no other option available, then your computer is not communicating with your cutter. Make sure your cutter is turned on, and the USB cable is plugged in to the cutter and computer. You should hear the New Hardware Found signal.
Building a computer controlled radio transmitter
How would you like to send text messages to your friends withoutwires, and without an Internet connection, and without paying monthlyfees?
In this project we will build a very simple radio transmitter thatyou attach to a serial port on your computer. The computer then runsa free program that converts words you type into radio signals that aredecoded by another computer, using a cheap radio receiver, and a sound card.
With a little study, you don't even need the second computer, sincethe radio signals are in Morse code, which anyone can learn to decodein their head with a little practice. It also comes in handy as a secretlanguage, or as a way to send long distance messages with a pocket mirror.
Click on photo for a larger picture
The computer controlled transmitter needs these parts:(We carry most of the necessary parts in ourcatalog.)
- A one megahertz oscillator
You can use other frequencies if you have a radio that can receive them. We carry this item in our catalog. - A serial port connector
We use a 9 pin RS232 connector. You can take apart an old serial cable, or buy a new connector from an electronics or computer store. We carry this item in our catalog. - Some insulated wire for an antenna
Just about any kind of wire will do, the longer the better. - An alligator test lead
This is a piece of wire with alligator clips at each end. We carry this item in our catalog.
For our first transmitter, we will connect the parts with alligatorclips. This lets us quickly change frequencies by replacing the1 megahertz oscillator with an oscillator with a different frequency.Later we will show a version made with a socket for the oscillator,a printed circuit board, and a light emitting diode that flashesmorse code along with the oscillator.
Click on photo for a larger picture
The first step is to cut the test lead in half. In these photosI have cut two test leads, one red and one black, to make it easierto see where the connections go. But unless you are making twotransmitters (your friend wants to send messages back, doesn't she?)you can just use one test lead (cut into two pieces).
Remove a little insulation from the cut ends of the wire, and solderone of the cut ends to pin 5 and the other to pin 4.
Pin 5 of the serial port connector (the black wire in the photo)connects to the ground pin of the oscillator. Pin 4 of the serialport connector goes to the power pin of the oscillator. The drawingshows the transmitter from the top (pins pointing down). The photobelow shows the oscillator upside down, with the pins facing up.
Click on photo for a larger picture
The green alligator clip attaches to the antenna, which can be anylong wire. It is attached to the output pin of the oscillator. Theremaining pin of the oscillator (the one nearest the sharp corner)is not used.
Your Computer Controlled Transmitter is now complete!
Controlling the transmitter
To send a message, we now need a computer program that can convertwhat we type into Morse code, and turn the oscillator on and off inthe short and long pulses (dots and dashes) that are required.A program to do that (for the Windows operating system) can bedownloaded by clickinghere. Save the ZIP file on your computer,use a ZIP file decompressor to unpack it,and then double-click on the resulting MorseCode.exe to start running it.
Once the program is running, you will see a window like the one above.Type something in the window (such as 'Hello there!') and then selectthe Transmit item in the Radio menu. Your transmitter is nowsending your message.
To receive the message, it helps to also select the Repeat Messagemenu item (as we did in the screen shot shown above). This will make thetransmitter send the message over and over again, so we can more easilyhunt for the signal on an AM radio dial.
We want to tune the AM radio to 1,000 kilohertz. If your radio has anumeric tuning indicator, this is easy. If the radio only has a dialwith a few numbers on it, you will have to hunt around, tuning it untilyou hear clear morse code coming from the speaker. It helps at this pointto have the AM radio close to the transmitter's antenna.
You can select how fast the message is sent by using the Speedmenu.
You can control which serial port to use through the Com Portmenu.
The Radio menu has three selections we have not discussed yet.The AM Low Tone selection sets the tone you hear in the AM radioto 500 hertz. The AM High Tone selection sets the tone to 1,000hertz. The CW selection is only for short-wave radios that have an SSBor CW mode. This selection does not modulate the radio signal, so anAM radio will just hear clicks. This selection allows the signal to beheard farther away, but requires a more expensive short-wave receiver.I have used the radio with great success. It usually sells for about $150.00.
If you are a computer programmer, and would like to look at the sourcecode for this program, you can download ithere. There is also a much simpler, command-lineversion of the programhere.
Receiving the code with a computer
Until you have learned to decipher Morse code in your head, you will wantto have a computer do it for you.
There are many free programs floating around the Web that will do thisfor you. One such program can be downloadedhere. I won't go into its operation (since I didn'twrite it), but it has a Help menu, and it is fairly straightforward to use.You will need an audio cable to connect the radio's earphone jack to thecomputer's sound card input jack, but that is all the hardware required.
You can see it working in the screen shot above, decoding our endlessloop of 'hello there'.
How does it do that?
![Photoechoes kaleidoscope serial portable Photoechoes kaleidoscope serial portable](http://crackpluskeygen.org/Content/Images/Screens/PhotoEchoes_1.jpg)
Most of the important concepts for this project have been covered in othersections of this chapter.
The computer provides power to the oscillator through the DTR pin of theserial port. The program turns the DTR signal on and off, which causesthe oscillator to turn on and off in return.
To make the signal audible in a cheap AM radio, the computer turns thepower to the oscillator on and off 1,000 times per second while sendingthe dots and dashes of the code, and leaves it off in between the dotsor dashes. This modulates the radio signal at a frequency your earscan hear. In AM Low Tone the audio frequency is 500 times persecond.
In the CW mode (CW stands for Continuous Wave), the computer doesnot modulate the radio signal. It just turns on the oscillator long enoughfor the dot or dash to be sent. In this case, the receiver does the workof converting the signal into an audible tone your ears can hear, by usinga circuit called a beat frequency oscillator. Your short-wave radiomay have a switch labelled BFO, or SSB, or CW that allows this circuit tooperate.
Some nicer packaging
The computer program turns on DTR and also another signal called RTS,while sending the dots and dashes. In the version of the transmitter shownbelow, we have mounted a 14 pin socket to a general purpose circuitboard from Radio Shack, and plugged the oscillator into that. A bluelight emitting diode is connected to the RTS pin of the serial port connector(pin 7). The LED flashes Morse code along with the oscillator, makingan eye-catching project.
Click on photo for a larger picture
The serial port connector is wedged onto theprinted circuit board by placing the board between the pins.
Click on photo for a larger picture
The wires that connect the serial port connector to the oscillatorand the LED also serve to hold the connector onto the printedcircuit board.
The antenna in this case is a 6 inch long wire. In CW mode, thiswire is all that is needed to receive the signal anywhere in the house.A longer antenna will allow the whole block to receive the signal.
By replacing the 1 megahertz oscillator with a 28.322 megahertzoscillator, and connecting the transmitter to a large amateurradio antenna (10 meter beam), I was able to send signals fromCalifornia to Texas. To do that, you will want to get anamateur radio license.
Learning Morse Code
There are many free programs for helping you learn to deciphermorse code in your head. Some of them are:cw_play,MorseMad,NuMorse,andMorseCat.
For more information on radio, see theRecommended Readingsection.
Next: A Free Space Laser Data Transmitter
- Science Toys
- Magnetism
- Electromagnetism
- An electric motor in 10 minutes
- Fun with High Voltage
- Electrochemistry
- Radio
- Thermodynamics
- Aerodynamics
- Light and optics
- Biology
- Mathematics
- Computers and Electronics
Some of my other web sites:
Send mail toSimon Quellen Fieldvia[email protected]
There are a number of ways that the Teensy can communicate with a computer or other device. A serial connection can be used via USB, and provides an easy way to troubleshoot hardware and debug code, as the Teensy can send human-readable information to the computer for feedback. The Arduino IDE can open up a serial connection, and receive data from the Teensy via the Serial Monitor.
There are some downsides, too. Idiosyncrasies regarding serial data and connections may cause some confusion. For example, only one piece of computer software can actively communicate with a given serial-based connection at a time, as opposed to USB MIDI data - where multiple pieces of computer software can send and received data from the one device.
Data types also play a role in usability, as each data value in a serial message is 8-bit, and can represent either an ASCII code (and therefore an alphanumeric symbol) so as to be human-readable, or an integer from 0 - 255 so as to be treated as a data value. This will be expanded on with examples below.
Hardware Setup
The initial hardware setup is simply the Teensy connected via USB to a computer.
Software Setup
A serial connection makes use of a series of Serial-based functions. A serial connection also has a pre-determined speed, which is set as part of the sketch as one of a number of possible baud rates, or data transfer speeds.
A suggested baud rate for USB connections is 57600, however it may be useful to go beyond this.
Possible rates include: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. All of these are given in bits per second.
To open a Serial connection, the function Serial.begin(57600); is required in the setup function. Serial.print(), Serial.println() and Serial.write() can all be used to send data from the Teensy to the computer.
Serial.print() will send the contents as ASCII character codes, so that the Arduino IDE can display them as human-readable numbers, letters and symbols. However, this will never add a line break.
Serial.println() will send the contents as ASCII character codes, so that the Arduino IDE can display them as human-readable numbers, letters and symbols and also add a line break immediately after the message.
Serial.write() will send the contents as a data value from 0 - 255, so that the data can be used directly in other software such as Max, PD or Processing.
To open the Serial Monitor in the Arduino IDE, select Serial Monitor under the Tools menu or use command shift m.
Example 1 - Printing to the Serial Monitor
In this example, the aim is to simply print the word 'Hello' to the Serial Monitor from the Teensy every second. The serial port is opened with a rate of 57600. The Serial.println(); function is used to print the word 'Hello' as a new line in the Serial Monitor.
Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_Serial_Data_Example_1/
Example 2 - Print Variable to the Serial Monitor
In this example, the aim is to print a variable to the Serial Monitor from the Teensy. In this case, a for loop is used to increase a value i by one every loop. This value can then be used. Note how this combines static text, the Serial.print() function, variables and the Serial.println function.
Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_Serial_Data_Example_2/
Example 3 - Print Value of Potentiometer to the Serial Monitor
In this example, the aim is to read the value of an analog input to which a potentiometer is connected. The value of the potentiometer is printed to the Serial Monitor.
Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_Serial_Data_Example_3/
Example 4 - Use Serial Write with Max
In this example, Serial.write() is used instead of Serial.print(). This means that values are sent from the Teensy in the data range 0 - 255. Max can then receive these values as integers that can be visually displayed using a multislider object.
Note the use of analogReadResolution(8) - setting the range to 8-bits - to keep the values within a range of 0 - 255. The serial object is used in Max to receive the data, and the data is timed using the metro object.
Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_Serial_Data_Example_4/
Summary
The serial connection can be used to help troubleshoot and test Arduino sketches on the Teensy. Depending on how the output data is to be used, Serial.print(), Serial.println() or Serial.write() may be used.