Canonical: https://toolipedia.app/microcontroller-lookup-table-generator

# Microcontroller Lookup Table Generator

Generate sine, cosine, triangle, sawtooth, square, gamma, CIE lightness or custom formula lookup tables as C arrays for DACs, PWM and LED dimming.

Breadcrumbs: Toolipedia > Developer tools > Code and developer utilities > Microcontroller Lookup Table Generator

## About Microcontroller Lookup Table Generator

Microcontrollers often lack a fast sine function, so you precompute a table and read it with an index. This generator writes C arrays for sine, cosine, triangle, sawtooth, square, gamma correction, CIE 1931 lightness for LED dimming, or your own formula in x. Choose 2 to 4096 entries, 1 to 32 bits, unsigned or signed values, decimal or hex, and optional PROGMEM for AVR boards. A 16-entry, 8-bit unsigned sine starts 128, 176, 218, 245, 255 and falls back to 0 at entry 12. A small plot shows the curve before you copy the code.

## How to use Microcontroller Lookup Table Generator
1. Choose the table type and the number of entries and bits your DAC, PWM timer or LED driver uses.
2. Set the array name, number format, values per line and whether the table is stored in flash.
3. Copy the C array into your sketch or download it as a header file.

## Why use this tool?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.
- Free to embed on your own website, with a ready-made code to copy.

## Also known as
- microcontroller lookup table generator
- sine table generator for arduino
- led gamma correction table
- pwm lookup table c array
- dac sine wave lookup table

## Frequently asked questions

### Why does the sine table not repeat its first value at the end?

Cycle tables use phase i divided by N, so the table covers one full cycle without a duplicate end point. Reading it with a wrapping index gives a smooth, continuous wave.

### What is the CIE 1931 table for?

Eyes see brightness roughly in proportion to lightness, not to power. The CIE curve maps a linear dimming step to the luminance that looks even, which makes LED fades look smooth.

### What can I write in the custom formula?

Numbers, x from 0 to 1, pi, e, the operators + - * / ^ %, brackets and functions such as sin, cos, sqrt, pow, exp, ln, abs, min and max. The formula is parsed, never run as code.

### Is Microcontroller Lookup Table Generator free?

Yes. Microcontroller Lookup Table Generator on Toolipedia is free to use, with no sign-up and no watermark.

### Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

### Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

### Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

### Can I put Microcontroller Lookup Table Generator on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.

## Related tools

More free tools that go well with Microcontroller Lookup Table Generator:
- [MIME Type Lookup](https://toolipedia.app/mime-type-lookup)
- [Image and binary file to C array converter](https://toolipedia.app/image-and-binary-file-to-c-array-converter)
- [HTML table generator](https://toolipedia.app/html-table-generator)
- [JSON to SQL INSERT Generator](https://toolipedia.app/json-to-sql-insert)
- [Database Table and Index Size Estimator](https://toolipedia.app/database-table-and-index-size-estimator)
