Tag Archives: Arduino

Some time ago I built an Internet gateway (iGate) for monitoring APRS packets and sending them to APRS-IS.  It never made it to the blog partly because it was built out of Direwolf, so it was mostly software configuration.

Since then, I've had trouble keeping soundcards running in the same configuration and the iGate was offline for some time.

Last summer (or the one before it, I don't remember), I bought the components to a packet station: an AEA PK-232 TNC, a Kenwood Mobile, and a broken power supply.  The broken power supply is still broken, but the rest is up and running.

The APRS Receiver Setup

The APRS Receiver Setup

The setup for the PK-232 is courtesy of LA6YIA on Google Groups:

XFLOW OFF
AWLEN 8
PARITY 0
RESTART
CONMODE TRANS
TRACE OFF
HID OFF
BEACON EVERY 0
PACKET
RAWHDLC ON
HPOLL OFF
PPERSIST ON
KISS ON
HOST ON

The APRX setup is not groundbreaking, but it's below, too, since it may help someone...

Then, since the ultimate test is to make it work, I wrote a simple Arduino Sketch using the Argent Data APRS Arduino shield and my trusty IC-T90A...

Obviously, this only transmits once, and it is using manually-entered location, but it does the job.

Look! It's here!

Look! It's here!

And of course, I could find some repeats in the log:

I'm in the log!

I'm in the log!

So at this point there should be better coverage in the far east of Cincinnati.

73!


Category: Equipment

I happened to stumble on an advertisement for a cool looking device that would work with a phone via Bluetooth.  It was ideally something that would be used for things like movie times, bus waiting times, or something else small and URL based... kinda like a QR code without the annoying camera part.

So I got a pair of RFduinos to play with it.  Programming it is quite simple, you just need Arduino 1.5 or later (which you would need for programming a Yun, Due, and possibly a few other Arduinos) and the RFduino libraries (see this).  The library comes with an example program accessible under File-Examples-RFduinoBLE-AdvertisementContinuous.

The only somewhat difficult part is dealing with the URIBeacon, and Adafruit publishes a tool to help with that, and Google has a more detailed explanation.

The top is the RFduino, the bottom is the USB shield, which is the easiest way to load it.

The top is the RFduino, the bottom is the USB shield, which is the easiest way to load it.

Of course it does nothing unless you have a device setup to receive it.  In the Play Store, there is a Physical Web app that can be used to receive the messages (until these become part of Android... and hopefully iOS, too).

The app is fairly simple, but it works!

The app is fairly simple, but it works!

Where This Is Going

Rather than beacon a web URL, I imagine with the proper programming (on both the RFduino side and the Android app side), it could be used to pass a variety of messages.  In fact, since the app looks up the description information, that could probably be used for simple messages (e.g. "the plant needs water").

This has some pretty cool IoT and alerting uses.  Stay tuned!

-73-


Category: Arduino

On the way back from a meeting, I dropped by the Columbus Micro Center Mall.  I really didn't know what I was looking for, but I figured I'd want to look at something for a project in the works (that involves an accelerometer or two), my Hack A Day Trinket Project, and anything else that looked good.

It was a good trip.

I grabbed a few (relatively expensive) breakouts for SOIC and SSOP chips, which I'll ultimately use one for an SA602 mixer. I also grabbed a small pack of resistors, which will be in use for my HAD Trinket project.  I found two accelerometers for $5 each (!!!).  I grabbed a few PC boards.  And the best part - a Yun for $55 (off their normal $75)!

I uploaded a microcontroller Hello World (a blinking LED) to the Yun via Wifi.  It was awesome and convenient.  The code is below, and it'll work for any Arduino or clone (I initially wrote it for a Trinket).

In action on a Trinket:

And on a Yun (I used the onboard LED):

Next week, back to the normally scheduled DDS mischief.

-73-


Category: Arduino

A while back, I bought a few DDS modules through eBay.  I used code from NR8O to program one of them and started pulling parts from the bin and pushing the output signal through the parts and into a load resistor.

2014-11-28 23.23.26

Experiment 1: Just a diode

2014-11-28 23.23.36

Result 1: the large waveform is the input signal (A), and the small bumps are the scope channel 2 (B). The diode rectifies the signal, which is why the bumps are only going up (and not down). The forward voltage drop on the diode is why the bumps are so small.

2014-11-28 23.30.07

Experiment 2: a diode bridge

2014-11-28 23.30.13

Result 2: This is similar to the circuit above, just more voltage drop because more diodes are involved.

2014-11-28 23.38.55

Experiment 3: Through a capacitor

2014-11-28 23.39.01

Result 3: the capacitor blocks DC, but allows AC through, with some voltage drop.

2014-11-28 23.39.50

Experiment 4: Capacitor parallel with load.

2014-11-28 23.39.56

Result 4. No change because there is nothing between the test points.

2014-11-28 23.41.35

Experiment 5: through an inductor

2014-11-28 23.41.39

Result 5: there was no change.

2014-11-30 14.23.58

Experiment 6: inductive load

The video below shows what happened.  I'm sure there's an explanation of the instability, but I don't know the explanation.

Stay tuned for experiments 2!

73 de KE8P


Category: Arduino

I bought an Arduino Due a while back, and not having anything seriously pressing, it was set aside for other things.

The Due has a lot of differences from other Arduinos for various reasons.  The stuff you'll see on most websites leads with "it's 32 bits and runs at 3.3 volts!".  And those are important - any non-EE like me using an Arduino thinks at 5 volts, and in some cases you can blow up a Due with that much voltage.  But there are more important differences:

  • 4 serial connections
    The Mega has 4 also, but the Uno and Leonardo have 1.  Some things, like GPS receivers and the APRS Shield use serial connections, so this is a more-is-merrier situation.
  • 2 I2C channels broken out and labeled
    All of the Arduinos have I2C interfaces, but they are not labeled on the Uno, Leonardo, and Mega.  Really, this is just an inconvenience because you can look up the correct pins.  The Due labels them so you don't have to look them up, and the Due is the only current Arduino board that has two I2C interfaces.
    I2C is useful for a lot of sensors, including temperature sensors, EEPROMs, real-time clocks, digital compass modules, and DACs.
  • 2 Digital-Analog Converters (DACs)
    On the Uno, Leonardo, and Mega, there are no DAC converters - the analogWrite command writes to PWM outputs on those processors and that output is still 5V, but the output is a square wave that makes some things (like LEDs) look like you've reduced the voltage, when really you've reduced the amount of time that the voltage is on.  Wikipedia has a longer explanation.
    DAC converters do not output a PWM signal.  Instead the actual voltage is output, so if you give a 3.3V DAC a command corresponding to 50%, it will output 1.65V DC (NOT PWM!).
  • Controller Area Network (CAN) breakouts
    CAN is mostly used in vehicles in part of the On Board Diagnostics (OBD-II) system, but it is being adopted elsewhere.  It's adoption may continue with increased adoption of the Internet of Things.
  • Digital Signal Processing
    Perhaps one of the more interesting parts of the board where amateur radio is concerned is that the main chip (where all the magic happens) is powerful enough (between being 32 bits and 84 MHz) that it can do Fast Fourier Transform operations as well as number crunching operations.  Since there are both ADCs and DACs, an analog input can be sampled to digital data, processed, and then output through the DAC back to an analog waveform.  See an example at M0XPD's blog.  This also enables the use of the Due as an SDR (another link to M0XPD's blog).

I'm going to be doing a lot more here with the Due, so this should break me out of the no-post-slump I've been in.

-73-


Category: Arduino
Tags: ,

Backstory:

I'm writing most of this as the ARRL June VHF contest is underway.  With the 706 still laid up (parts did NOT come on Friday the 13th with a full moon... positive omen? No.), it's on the bench gathering a little dust.

So I noticed in QST the August 70cm contest.  I have 20' (+/-) of masts, and 20 watts on 70 cm, and I can make an antenna... but I would need a good directional antenna because I have no interest in buying a 400 MHz linear amp for a contest that I may not have any contacts in.

"Good directional antenna" means a yagi or a quad.  It also means it needs to be rotatable.  I could just turn the entire mast, but I don't know how that will work - my poles are fiberglass, and will have to be guyed, so that may be easier said than done.  I have a junk box full of stepper motors, I have some Arduinos... this could get fun.  Even better, it is temporary, so I don't have to drop big bucks to do this.

So my thinking is that I want an inexpensive home-built rotator.  I want the rotator to know where the antenna is pointing, and there are two components to this - a rotation sensor to tell me where the antenna is pointing and a sensor to act like a compass to tell me where north is.

All that being said, this is post 1 of 2.

Angular Sensors

For the hobbyist, there are basically four encoder options: optical, magnetic, capacitive, and mechanical.  These can be incremental - where it tells you that there is change and how much the change is (or a pulse on change) or absolute (where it gives you a specific position).

Optical

Optical encoders are commonly found in printers and scanners, and the same concept was used by Ben Heckendorn on his Doggie Treat Dispenser.  These have an optical sensor that looks for dark/light marks on a disk on a rotating shaft.  I don't know about prices for these, since I have a few of them from a coworker's printer that stopped working.

2014-07-06 15.45.35

Magnetic

Magnetic encoders operate by using a magnet and a hall effect sensor to sense the change in the magnetic field due to the magnet's rotation.  I'm guessing (operative word!) that these are bad to use in strong magnetic fields (like near a motor, hard drive, or one of those big electromagnets used in junkyards to lift cars).

It appears the only magnetic encoders available (for hobbyists) are analog - they give a voltage output based on the rotational position.  This has the benefit of being absolute or semi-absolute.  Prices range from $10 to $45 from the big US suppliers.  Their use with an Arduino would be similar to the use of a light sensor (although the voltage divider may be built into the sensor, so you may not need to have one separate).

Capacitive

Capacitive encoders work similarly to optical encoders, but instead of using a beam of light, it uses a set of disks and a capacitance sensor.  Benefits (according to CUI) are that dust can mess up optical encoders and that LEDs can burn out.

Capacitive rotary encoders run around $25 and provide up to 2,048 positions of output (that's one every .18 degrees!).  Looking at the linked item, it seems to be the most ready-to-use sensor, depending on the application.

Mechanical

Mechanical rotary encoders are common in selector switches.  They have mechanical rings inside (I couldn't find a good explanation of how this works).  They are inexpensive and common, but I'm not sure of their use within an antenna rotator.  Truthfully, the amount of torque needed to turn a selector switch is so much that I'm not sure this is really an option.

Next Step

As the only picture on this post indicates, I have a motor with a sensor.  I am going to build that into some sort of rotator that can be mounted on top of a fiberglass pole that I can use to turn the antenna.  I don't know if I can have it done by August, but I'm going to try... presuming I get the 706 fixed first!


Category: Arduino

Last week (on a post that proved that even an evil genius can sometimes mess up simple math and set a post to fire 4 days early) was the introduction, today is some new findings.

Memory

If you follow the directions and treat this like an "Arduino Pro or Pro Mini (3.3 v, 8 MHz) w/ATMega 328", the Arduino compiler will tell you that there is a 30,780 byte maximum.  In my experience, the maximum is around 26,000 bytes.  Wyolum knew about this, and this is why they included a micro-SD card slot and card.  At one point, I tried creating a program that would tell the temperature and lines from the Zero Wing intro ("All Your Base Are Belong To Us!").  It didn't go well.

Temperature Sensing

The temperature sensor is very simple to use.  Recall in the last post, the sensor itself is populated, but a 0.1 uF capacitor (C8) is not.  The sensor might work without the capacitor, but it likely works better with it (at least I hope so, I populated the cap without testing and I have zero interest in removing it).

To read the analog pin and get it to a voltage, the following code works for me:

int ar=analogRead(7);
float vref=3.3;
float temp=ar*vref/1024.0;

Even though the Pro and Mini do not have 7 analog pins, the Arduino IDE and compiler not only do not complain about not having the pin, they compile it correctly without modifying any of the libraries (Good on ya, Arduino!).

Looking at the data sheet, there is a simple equation for the temperature:

V_{out}=T_{C}*T_{A}+V_{0}

Where:

V_{out} is the output voltage

T_{C} is the temperature coefficient

T_{A} is the Ambient Temperature

V_{0} is the voltage at 0°C

Per the documentation, I used V_{0}=0.5v and T_{C}=0.01V/C.  Using algebra (who says you'll never need it?), I used:

T_{A}=\frac{V_{out}-V_{0}}{T_{C}}

Which would give me the temperature in Centigrade, and after that,

T_{F}=\frac{9*T_{C}}{5}+32

In Arduino, that wen't like this:

temp=temp-0.5;
temp=temp/0.01;
// C to F
temp=(9*temp)/5+32;

And it seemed to work correctly.  I was getting temperature readings of around 74 in my office, and it seems like that is correct.  The final code is below.

...and of course, I can't show all this code without the finished product:

It's a warm 75 in here today... and it does feel kinda warm in my office.

It's a warm 75 in here today... and it does feel kinda warm in my office.

By the time this post fires, I will have just returned from a transportation conference.  I hoped initially that I'd have more with this post, but it'll have to wait for next week's post.

-73-


Category: Arduino

Ever since seeing the name badges from the Open Hardware Summit 2013, I wanted one.  I tend to make it to 2-4 transportation conferences a year, plus 3-5 hamfests, so having a cool looking badge is... well, just a want.

2014-03-31 22.22.08

The front. Five buttons and an e-ink screen.

2014-03-31 22.21.49

The back. Coin cell, on-off switch, microSD card, serial headers, and components.

First off, the e-ink screen idea is pretty awesome.  It maintains an image with the power off, which is a great feature (especially since there are only around 100 page turns on that coin cell).

The powerplant of this is an Atmega 328p.  The same Atmel processor used in the Uno, Pro, Nano, Fio, and some Lilypads.

Per the website, there are two unpopulated items - a realtime clock and a temperature sensor.  However, looking at the schematic and the board, I see the unpopulated realtime clock area in the upper left area of the board, but in looking just to the left of the 328, there is a temperature sensor - the only unpopulated area is for a 0.1 uF capacitor!

I didn't even program the thing before fixing those little omissions.  I had to make a little change to the realtime clock I had is an NXP, and the doc calls for a TI chip.  The only difference - pin #3 is a backup power input on the TI chip, and on the NXP chip it is an interrupt output.  I clipped the pin prior to soldering.  I also soldered the ICSP and I2C connections, since I think I may end up using those at some point.

2014-03-31 23.20.34

The first thing I did with the BADGEr is get a copy of the firmware that is on it.  After trying to use avrdude with an FTDI board, I did what I should have done the first time - used the Bus Pirate.  Using the connection instructions on Dangerous Prototypes' website, I used the following avrdude command:

avrdude -c buspirate -C"..\etc\avrdude.conf" -P COM9 -p m328p -U flash:r:"C:/badgr.bin":r -b115200

** CASE SENSITIVE **

The -c option tells avrdude what programmer avrdude is using.

The -C option tells avrdude the configuration file.  In my case, I'm running this from somewhere down in the Arduino IDE folder, and relatively speaking, backup one and then into the etc folder.

The -P option is the port number (in my case, COM9)

The -p option is the part number, in the case of the BADGEr, it is an ATMega 328p and per this page, that is the correct string to use.

-U is the operation.  'flash' is the part of memory to work with, r means to read, the next part is (obviously) the file path, and the final r is for 'raw binary'.

-b115200 is the connection speed.  My Bus Pirate is setup for 115200 bps, so I used this.  It will not work if incorrect.

Once I ran this (well, twice because I forgot the final r option in the -U portion), I got a raw file with the code on the device.

It takes a while...

It takes a while...

It took 1,048 seconds, or about 17.5 minutes.  For a 32 KB file.  There's some fixes for that HERE.  Use them well.

Initial Programming Experience

After screwing around for several days trying to load the BADGEr from SPI, I fixed one of my FTDI boards and got it to work.  My advice here: don't even mess with trying to load sketches via the SPI interface.  It won't work (and I'm not sure that was ever intended).

Initial Program

Thoughts

The battery included died very quickly.  I think my next improvement will be a better battery!  This DOES need a good power source when programming.  I initially used my Bus Pirate to power it while programming it from the FTDI cable.

-73-


Category: Arduino

Yes, I shouted that.  And for very good reason - Arduino started me down the road of playing with micro-controllers (you can tell I haven't made a red cent on any of this - I call it "playing" :-)).  I guess you could consider Arduinos to be my gateway drug into Raspberry Pis, Beaglebones, and PICs.

In celebration of Arduino Day, I decided that I should list a few of my favorite Arduino Projects (some are still in progress).

The Filter Sweeper

This is probably the coolest thing I started to write.  It is also the most useful, as it would have it's uses with any receiver setup, whether it is a home-built radio, an RTL-SDR, or even an off-the-shelf radio).

The Bus Pirate Arduino Shield

I didn't do very much with this, and what I really learned wasn't even discussed in the post- I really learned how to 'break out' of the Arduino IDE and load an Arduino from the command line.  With Linux.

The Arduino Easy Logger Button

This is the start of what ended up netting me a ChipKit WF32.  I want (and still need to finish) a setup that makes it easy to log my radio contacts while mobile.  The Arduino version is around 90% done, but with several things taking my time it hasn't been finished.  And the ChipKit version has got a longer road.

-...-

I thought I'd have more of these, but I guess I don't. I do have a few "in the queue", though, so hopefully when I write some for AD15, I'll have a few more.  Either way, I've learned A LOT and I know I have several more posts coming that use my Mega 2560 and Due (and maybe even that Leonardo I picked up a few weeks ago).

-73-


Category: Arduino
Tags: ,

I'm not going to call it a spectrum analyzer anymore - the way I've designed this, it isn't going to do the same things as a spectrum analyzer.

The main difference is that a spectrum analyzer can operate without a signal generator, this won't because the signal generator is what is going to tell the Arduino what the frequency is.

I built another shield to stack onto the shield in last week's post.

image

There is currently no connection from the DDS to this yet, but that's one of the only few things left to do on the hardware side.

I also built a filter that will ultimately be the first filter to test. This is for my Softrock 20/30/40 and should pass 7 MHz while filtering 14 MHz.

image

This will fit in a Radio Shack small plastic enclosure - the plate was leftover from a small dummy load that I glued into the enclosure.

-73-


Category: Arduino, Equipment
http://www.ke8p.us/feed/ http://twitter.com/ke8p

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



This is the new server