Arduino sketch generator

On the side of our dashboard for TTN Den Bosch we, some time ago, created a tool to generate Arduino sketches in a simple and fast way for the members of our community.
I know there is still a lot to do, but the basics are working. Maybe it is time to share it with a bigger audience.

You can find it here: https://lcd-web.nl/ttngenerator/

The tool is in PHP/Mysql.
The base is a template where some spots need to be filled depending on selection of radio, sensors, etc.
The tool is a form to enter/select the variables and a function to generate and display the sketch. The generated sketch can be copied to the Arduino IDE.
The function simply replaces some placeholders in the template and inserts the code that belong to the selected radio and sensor.

Things I would like to add:

  • access TTN console to select a device and get the device keys
  • test RN2483 radio; more specific which library to use best and test OTAA
  • use the device keys in the (string) format as currently displayed in the console
13 Likes

Excellent. Tnx

1 Like

Nice idea, will test later

1 Like

Thanks for sharing, took a quick look and it generates nice templates.

1 Like

Please give it a cool name “Automatic TTN - Code Generator” aka “AT-CG”, or something, then please put it on github for others to help (i would love to do so).

Stuff i would like to add:

  • Give the Pinmappings “Names” aka “Pinmapping for loratracker PCB”/“Pinmapping for charles red PCB”/etc.
  • Add Pictures from those PCBs, so people are 100% sure to take the right one
  • Add custom pins for the sensors
  • Put deveui/appeui/etc. in seperated input fields to make copy&paste easier
  • Tell about the used libraries for the different sensors outside of the code (make a warning on top for example) and make it easy for people to find/download/install them

Just to give you a few ideas - and thank you very much for the work done already!

5 Likes

Jdelaet, nice idea. I look forward to trying it. If you pm me your address, you’ll get a RN2483 Arduino in the mail to test with…

2 Likes

Thanks @JDP.
I have a R2483 available to test, so no need to send yours. But very much appreciated.

The R2483 generated code should work for ABP devices. I need to test it for OTAA, but need to find the time to do that.

Any suggestion which library would be best to use for R2483?

Thanks, Jan

Great! I use both TTN and Sodaq libraries. In Arduino IDE under library manager filter by ‘RN2483’ and you’ll find those 2, plus some others

This sketch generator is very useful for us and someone who is not an expert on C programming. Please keep update. Thank you.

there is no link for the Lowpower library documented, but I assume that you mean

1 Like