ATS-25 Radio programmed with Espruino

Posted on
  • These all-band (FM,LW,MW,SW with SSB) radios (see picture below) are available on AliExpress and Ebay. They consist of an SI4732-A10 chip which provides the radio functions driven via I2C by an ESP32 WROOM module which implements the display interface. This is an ILI9341 (with XPT2046 touch ) 320x240 pixel display.

    There is an extensive well documented Arduino library for the SI4732 and a sketch which implements the firmware running on the pictured radio. The firmware can easily be updated from Arduino via the USB-C port at the rear of the radio. However, the combined library and sketch is over 10,000 lines of C++ which makes it cumbersome to change so I had a go at an Espruino version. So far I have implemented the FM only radio shown in the video:

    https://youtu.be/1rce91vy35w

    There were a few technical challenges in getting this to work. Firstly, the display and touch controller share the SPI bus and while the screen SPI runs at 20MHz, touch only works with SPI at around 2MHz so you have to re setup SPI each time there is a touch interrupt. This generates a new SPI reference which needs to be passed back to the lcd_spi_unbuf driver. I implemented a simple additional function in this driver to pass back the SPI reference.
    @Gordon have you met this issue before with the ILI9431 and XPT2046? - it's a very common display.

    Secondly, the rotary controller does two increments every click which is not ideal and the module in the Espruino library seems to generate a lot of spurious increments. I implemented a new driver based on an elegant idea outlined here.

    Lastly, the rotary controller knob press switch is connected to D33 which cannot be used in setWatch in the current ESP32 Espruino. Indeed it did not work as a digital input at all so I implemented a simple polled routine which used analogRead to detect the press event.

    I plan to extend the implementation with LW, MW and SW with SSB - the current Espruino S/W and Firmware can be found here.

  • Wow, that looks great!

    have you met this issue before with the ILI9431 and XPT2046?

    I don't think so, no. Whenever I used it they were on separate busses.

    rotary controller does two increments every click

    Have you seen setWatch has a data argument? I guess it might work just to use that with a debounce. I guess a falling edge when data=0 is one way, falling with data=1 is another?

  • It's nice to know that someone finds the strength and time for such experiments.

    Pong would look good here or Breakout. In general, scroll wheel control looks interesting!

  • Yes, some of those options might help, however, the code below proved the simplest most reliable driver.

    
    function createEncoder(pinA,pinB){
      pinMode(pinA,"input_pullup");
      pinMode(pinB,"input_pullup"); 
      var a0=pinA.read(), c0=pinB.read(), incr0 =0, second=false;
      var OBJ = {};
    
     function handler () {
       var a = pinA.read();
       var b = pinB.read();
       if (a != a0) {              // A changed
         a0 = a;
         if (b != c0) {
           c0 = b;
           var incr = (a == b)?-1:1;
           if (incr!=incr0 || !second) OBJ.emit("change",incr);
           incr0=incr; second = !second;
         }
       }
     }
     setWatch(handler,pinA,{repeat:true,edge:­"both"});
     return OBJ;
    }
    
    
  • Having a lot of fun with this. The latest version implements RDS and stores an unlimited number of station presets. The code is a lot simpler than the Arduino equivalent.

    https://youtu.be/Yk6XuBNn9mA

  • #jeffmer, Bull's Eye! - That's all I can say...

    So: you got yourself such a device, ripped out the Arduino stuff and put in an Espruino w/ your code?

    I'm kind of curious to know whether there is still enough space left to have a Morse Code interpreter / decypher DX transmissions on SSB?

  • There is enough space, however, all the signal processing is done by the SI4732 chip so the audio output goes straight to an amplifier. The ESP32 controls the SI4732 via I2C and does not get access to the audio output so sadly without a hardware mod, you cannot do things like Morse decoding which would be neat.

  • Ic. Thanks for clarification. I think I get it: it is 'just' a SW replacement... nice! Like the Bangle.js watches: taking an existing hardware and software and replace the software. Very interesting. The word 'just' just does not do justice to the work you put in, even peeking at the Arduino implementation / its doc.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ATS-25 Radio programmed with Espruino

Posted by Avatar for jeffmer @jeffmer

Actions