Παρασκευή 24 Μαΐου 2024

Mikrotik and DynDNS

I thought the following code will help those who have trouble setting up the DynDNS service with their Mikrotik router. 

Although there are some scripts on the Mikrotik forum, there doesn't seem to be any official support and the Dyn instructions are very "poor".


So, I did some research, I collected the various scripts I found and finally I wrote my own script, that also has the ability to notify me whenever my public IP changes.


Of course you have to set up the email service in Mikrotik so that it can send you the notification.


The following script has been tested on ROS versions 6.49.15 and 7.14.3 on different devices and runs smoothly.



#---------- SCRIPT INFORMATION ------------------
#
# Script : DynDNS Update Script
# Version: 1.0.0
# Created: 21/05/2024
# Updated: 21/05/2024
# Author : SV1BGM
# Website: https://sv1bgm.blogspot.com
#
#--------- MODIFY AS NEEDED ---------------------
#
# DynDNS parameters (enter yours)
:local hostname "test.merseine.nu"
:local username "test"
:local password "test"
#
# DynDNS apiKey (in future version)
#:local key "apikey"
#
# Set true if you want to use IPv6
:local ipv6mode false;
#
#------------------------------------------------
#
# Free Online services IPv4
#
:local Service1 "https://api.ipify.org/"
:local Service2 "https://ipv4.icanhazip.com/"
#
# Free Online services IPv6
#
:local Service61 "https://api64.ipify.org/"
:local Service62 "https://ipv6.icanhazip.com/"
#
#------------------------------------------------
#
:local previousIP; :local currentIP; :local result
#
:log warning message="START: DynDNS Update"
#
# Check if ipv6 is enabled
#
if ($ipv6mode = true) do={
	:set Service1 $Service61;
	:set Service2 $Service62;
	:log info "DynDNS: IPv6 mode enabled"
}
#
#------------------------------------------------
#
# Resolve stored DynDNS IP address
#
:do {:set previousIP [:resolve $hostname]} on-error={ :log error "DynDNS: Could NOT resolve hostname $hostname" };
#
#------------------------------------------------
#
# Detect current public IP address
#
:do {:set currentIP ([/tool fetch url=$Service1 output=user as-value]->"data")} on-error={         
		:log error "DynDNS: Service down-> $Service1"
#		Second try in case the first one is failed
		:do {:set currentIP ([/tool fetch url=$Service2 output=user as-value]->"data")} on-error={
			:log error "DynDNS: Service down-> $Service2"
		};
	};
#
#-------------------------------------------------
#
# Here is the main script to update IP for the DynDNS host
#
:log info "DynDNS: Resolved IP : $previousIP, Current IP : $currentIP"
#
:if ($currentIP != $previousIP) do={
	:log info "DynDNS: Current IP ($currentIP) is not equal to Resolved IP ($previousIP), update needed!";
	:log warning message="DynDNS: Sending update for $hostname";
#
	:local str "https://$username:$password@members.dyndns.org/nic/update?hostname=$hostname&myip=$currentIP";
	:set result ([/tool fetch mode=https url=$str output=user as-value]->"data");
	:log info "--- REPLY from server : $result";
	/tool e-mail send to=test@test.com subject="Your IP Changed" body="New IP : $currentIP \r Old IP : $previousIP \r Response : $result"
#
	} else={
	:log warning message="DynDNS: No IP Change, No update needed";
	}
:log warning message="DynDNS: END of process";
#
# End of script. Easy!
# ---------------------------------------------------

Several lines of the above code are just for you to see in the logs what is going on. You can safely delete them, but I like them there.

Obviously you should use the scheduler and set the script to run every 15 minutes or more, if your IP doesn't change frequently.

In no way do I claim to be an expert and I have no responsibility if this script does not "run" correctly and does not refresh your IP in the future. After all, Mikrotik has built-in capability and provides you with a free hostname; it's just not as visually nice, it's big and probably impossible to remember!

Feel free to send me your comments and suggestions to make this script better and with more features.

73, Fanis

SV1BGM

Σάββατο 11 Ιουνίου 2016

Yaesu FT-817 touch screen display

*** This is a work in progress !
If you are interested in this project, then please like my page at Facebook and you will be notified about the status.

Here is my latest project for my FT-817. I know that many hams use this little and good radio for base station. I think that the screen is very small and provides very little information about the radio settings. I also found that sometimes is difficult to navigate through the radio menu and change some basic settings.
For a very basic demostration please watch the video :


And another video below showing direct frequency entry :


So I came with the above idea... At first I designed a project with a 4x4 matrix keyboard along with a 2x16 display. But after I found that I can use a much better display, large and color, with a touch function, I quit my first design and I changed my code to support this newer design.

More information will follow. Currently I'm working on the first version of my software, for both the display and the PIC microcontroller. So as you can imagine, the 2 basic components are : the Nextion HMI 3.2 inch touch screen and from the famous PIC family, the 18F46K22 mcu, which I use in many of my projects and I have a large stock.

This page will be updated with a schematic, documentation and a pcb artwork, when I finalize the design. I haven't decided yet about the source code of the project. I'm always open to suggestions about further development or features that you may want. Please don't comment at this page, instead use my Facebook page, where you will find the latest project info.

73, Fanis
SV1BGM

Πέμπτη 5 Μαΐου 2016

Simplest PIC programmer ever !!!

I beleive everyone involved with microcontrollers programming is looking for free and easy to use tools in order to acheive their goals.

I like very much PIC micros and I have 2 commercial programmers, a PIC KIT2 and a PIC KIT3. But I also wanted to have a simple programming cable to carry with me everywhere I go and use it in the field. I own an older Dell Latitude laptop with a serial port, so I searched for an easy way to make the simplest PIC Programmer ever !!!

Here is what I build. It could not be simpler !!!

Simplest PIC Programmer ever !!!
You only need three 4K7 resistors, a DB9 female connector and some cable. You can build this in less than half an hour.

All my PIC projects have an "in circuit programming" connector, which is nothing more that a SIP5 male pin header, like most PC's have on their motherboards. The end of my cable terminates to a female SIP5 connector and that's all.

If you read the datasheet of your PIC chip you will easily identify the PGC, PGD, Ground and MCLR pins. Connect them as shown in the diagram above and you are ready to go. Always remember that most modern PIC's require the MCLR pin to be pulled up to Vdd through a 10K resistor. A 1N4148 diode may also be placed in series with the resistor as shown in the diagram below :


When you design your PCB follow the above connection diagram. This way you can use any "in circuit" programmer available and you will save a lot of trouble and cabling.

You are done with the programmer hardware. So, what about a programming software ?
The best and FREE programming software I use is PICPgm. Very easy to use, just select your device and upload your hex file (if you don't know how to create a hex file or anything about PIC programming languages, then you most likely have to study a little and read some programming tutorials first !).

This programmer is tested and known to work good with 18F46K22, 18F26K22 and most other chips form the 18F series. Please have in mind that many USB to Serial adapters might not work as a "native" PC serial port. 

I hope you enjoy this simple project and I wish you happy PIC programming.

73, Fanis
SV1BGM

Πέμπτη 28 Απριλίου 2016

A cheap - homemade GPS mouse for Kenwood mobiles

Older Kenwood mobiles, like the TM-D700 I own, have a GPS input to connect an external GPS device in order to send APRS packets with your position data to the network. You can find a ready made GPS mouse, but the cost is around 70-80 USD.

You can build your own GPS mouse for around 15-20 USD if you buy the necessary components from eBay or other Chinese suppliers. If you choose eBay then search for the following :

1. NEO-6M GPS MODULE (about $10,00)
2. MAX3232 CONVERTER (about $2,00)
3. 5V USB STEP DOWN MODULE (about $2,00)

You will also need a small plastic box (about $4,00). That's all you need.

Check the photo below for the components (the USB step down module in not shown because it's housed in another box in my car, serving also other devices).

NEO-6M GPS Module and MAX3232 RS232 to TTL
The above modules need 3.3 to 5 Volts to operate properly. This is why you need the USB step down module. When ordering the USB step down module pay attention to order one that accepts 24 Volts input. If you order one that accepts only 12 Volts, then you will most likely burn ALL the connected modules because the car alternator supplies much higher voltage (mine supplies at peaks almost 16 Volts) and WILL burn the step down module.

Only 2 wires needed between the GPS and the MAX3232 module. Just connect the GPS output (TX) to the TTL input of the MAX3232 (RX) and of course the common ground. You don't need other connections.

The RS232 to TTL converter is needed because the TM-D700 accepts RS232 signals and the NEO-6M GPS module provides TTL signals. Don't forget to connect the 5V supply from the USB step down module and of course the common ground. Check the connections below :


 The RS232 output (TX) from the MAX3232 module goes directly to TM-D700 gps input. If you have the original gps cable that came with your transceiver, then you must connect this to the white cable (some others report the red cable, I guess different batches may have different colors). Of course, don't forget to connect the common ground. If you don't have the original cable, then you can make your own like the schematic below :


Here are the main components inside the plastic box. It's size is slightly larger than a matcbox. Later, using a hot glue gun, you can secure the cables and the modules inside the plastic box to avoid the mechanical stress from car vibrations.


And finally a few words about the USB step down module. I got this one :

I use it for about 2 years without a problem. I kept the usb connector and I put it in a small plastic box near the instrument panel of my car. I soldered 2 cables that go to the NEO-6M and MAX3232 modules for the power supply and I added a small switch at the input in case I need or want to disable the gps by cutting the power.
Please have in mind that NEO-6M GPS module works at 9600 bps, so in order to work with your TM-D700, just go to the relative menu setting and change the gps speed from 4800 to 9600 !



That's all... The whole system is working flawlessly for more than 2 years at extremely high temparatures inside the car. Now you can transmit your position data to the APRS network.

73, Fanis
SV1BGM

Πέμπτη 4 Φεβρουαρίου 2016

Kenwood TS-790 IF output for SDR panadapter

I recently got a second hand TS-790 with the 1.2 GHz unit installed and after a good cleaning and service I've done, I decided to search the options I have to get the IF from the radio to feed my SDRplay wideband receiver.

There is no doubt that software defined radios are the future... I thought it would be very nice to have a panoramic view of the bands while using the same antenna.

After search I found the TS-790 service manual and I started to study it. This rig has 2 independent receivers (main and sub) and as a result has also 2 IF's. The IF for the main receiver is 10,695 MHz and the IF for the sub receiver is 10,595 MHz.

I decided to go for the sub band IF because I didn't wanted to mess with the transmit circuits used in the main band. Looking at the block diagram it seems that the signals from all the bands (VHF/UHF/SHF) are going into the XF1 filter and then to Q5 fet amplifier. So the best place to tap for the IF would be the drain of Q5 fet. Respectively, if someone wants to get the IF from the main band should look for the drain of Q56 fet.

Kenwood TS-790 IF Block diagram
At the schematic diagram below you can see the exact tap point. Sorry for the bad quality of the pictures, but the scanned service manual is very bad...
KENWOOD TS-790 Schematic with SUB IF TAP POINT

Of course, you can't just solder a simple wire and get the IF. You need to add a suitable buffer amplifier to isolate you from the circuit and that way you don't have losses at your sub receiver.You have to use a good quality RF cable and place the buffer amplifier as close as you can to the tap point. 

You will also need to get somewhere the 13,8 volts to give power to the buffer amp. You can build your own buffer or you can buy one, as I did. I chose to buy from G4HUP.  

There is a lot of work needed to actually reach the IF tap point. If you feel that you cannot do it, then DON'T TRY IT. You may damage your expensive radio. Ask for help from someone that is more qualified to do this.

I take no responsibility for any damage that this modification may do to your radio. Proceed at your own risk !!!  

Remove the bottom cover of your radio. You will see the IF board. Then you have to remove the IF board. To do that you must unscrew first all the screws keeping the board in place and also unplug all the cables. There are many cables !!! It's highly recommended to take a high resolution photo of the board with all the cables attached in case you forget their position.

Then locate the IF tap point. In practice I soldered the cable directly to the L3. I find it's a good place and not very risky to burn the FET or other components. Don't forget the shield of the coax, use as ground the case of L2. Use a good quality RF cable. Secure the cable to the board with some tape. Check my photos below. (G4HUP does not provide the input RF cable, he provides only the output IF cable with a male or female SMA connector). I got the male SMA option to connect direct to the SDRPlay receiver input.

IF TAP POINT DIRECTLY TO L3, SHIELD TO L2

You will also need power for your buffer board. A good and safe place is the pin 7 of the ACC 4 connector. It's at the back side of the board, a little far, but I didn't have any RF problems. This pin provides 13,8 V from the main power switch of the radio. If you search carefully you may find a closer place to get the power. I was in a hurry to test this mod, so I didn't searched more :-)

13.8 V from power supply
The buffer board is secured with double side tape on the chassis at the front. For easy installation, the IF output cable is routed on the top of the board, however you can route it from the bottom. Use tireups to secure the cable from moving front and back.

Buffer board in place
General view of the IF board with buffer installed
By using the tap point at L3 you will only have a maximum usable bandwidth of about 50 KHz because of the filter on all bands (V/U/S).
If you want to see more bandwidth at your waterfall, you can try a different tap point at L1. This will give you at least 1 MHz (and much more), which in some cases might be more usefull.

If you go up to the top of the page you will see at the IF schematic diagram a GREEN point. This is L1. Click on the picture below to see in detail my second test with the tap point at L1.

Don't try to get the IF without a buffer amplifier - isolator, or you will loose RX sensitivity and maybe damage your radio. This is NOT recommended and NOT guaranteed.

IF tap point before the filter (at L1) for maximum bandwidth
I think I'll stay with the second solution for maximum bandwidth, it makes more sense to me for my needs and works good. I have tested the VHF band and the results are excellent. Same performance on receive and almost 2 MHz (and much more) of bandwidth at my waterfall. But please have in mind that tapping at L1 will NOT give you more bandwidth at UHF and SHF bands, since the signal coming from the 430 and 1200 RF boards is filtered before. If you want more bandwidth at these bands you have to tap to the RF boards. I didn't do it because I'm mostly interested at VHF band.

My favorite SDR software is HDSDR. It's free and easy to use. Configuration is very easy. Just set the IF frequency to 10.595 MHz and start listening !!!

HDSDR IF CONFIGURATION
Of course there some other options needed to be set, but this is out of the scope of this guide. For example you can set the software to control your TS-790, sync frequencies in both directions, etc... There are many tutorials online, just search them. And there are other software packages available, such as SDR Console, SDR# and others. 

So many options and a totally new way to enjoy my radio and hobby...

73, Fanis
SV1BGM