Day 5 of 30 (in 30 days of Geek) – Quick nifty hacks you’re proud of

This is Day 5 of 30 (in 30 days of Geek)…

Today’s post is about “Quick nifty hacks you’re proud of”.

I find I spend a lot of time whipping up quick little hacks, and then reuse them later in real applications if they worked well.

One great example of a quick hack I did is a Serial port sniffer, in python.

I have added code for your amusement 🙂

Step 1:

take 3 FTDI USB serial modules like this:

Step 2, wire up the 3 modules:

  • chip 1 –> wire up to your serial device using wires like a normal rs232 app
  • chip 2 –> (RX sniffer line) connect the input lines from this chip to the RX line from chip1
  • chip 3 –> (TX sniffer line) connect the input lines from this chip to the TX line from chip1

Chip 1 is the main connection from your PC to the serial device.  Your application should work with just this connection.    Chips 2 and 3 are just “listening” to the data that is flowing through chip1

Now… plug all 3 lines into your computer, and fire up this python application.

As data passes from your serial device through chip1, the sniffer application then sees data that it hears on the RX line and TX lines, and prints it to screen (color coded)  and a logfile.

link to source code

About andy dingfelder

Andy is a CISO/CTO in the fintech sector with over 20 years of experience in Software Delivery and Team Leadership in multiple industry domains. Master's Degree (MPA) in Public Administration Information Systems and over 10 years of board governance experience for multiple organisations. Full bio is available at: http://www.linkedin.com/in/dingfelder and links available at https://linktr.ee//dingfelder or follow him on Twitter at http://twitter.com/dingfelder. Andy lives in the Wellington region, New Zealand with his wife and two daughters.
This entry was posted in Misc. Bookmark the permalink.