-
-
-
The sockets are actually for IC pins and the last place I bought something similar was from Mechboards .
The usual breadboard jumper wires are too thick for these sockets and I am afraid I have no idea where the ones in the picture came from.
-
Here is the video of the editor in action writing the traditional hello world program. The typing is a little painful as I am used to using this keyboard with my thumbs.
https://youtu.be/eWG1iZ8Woz0?si=R9hkCvVP_7za8025
There is an example of cut and paste at the end of the video.
-
I have posted a more comprehensive description of this on Hackaday https://hackaday.io/project/195010-pocket-pad/ . It has also been picked up by a Hackster writer here.
-
Thanks, that is interesting, I will try it on the boards I have. Yes, I think the main difference is the 3.3V regulator. The full schematic for the nice!nano can be found here https://nicekeyboards.com/docs/nice-nano/pinout-schematic. There are two versions. I think the AliExpress board is like V1 except that the resistor should be 2M not 5K. I have the V2 board which has a different circuit for the external 3.3V.
Can you post a photo of the location of the 5K resistor.
-
-
@Gordon Thanks, I missed the keypad module but that is exactly how my scanner works. To make sure nothing is missed, I keep the scanner active for 5 seconds from the last key event after the first keypress wakes it up then it goes back to waiting for a key interrupt as you describe.
@fanoush In fact, I started with some of the Aliexpress modules and in some ways, you get what you pay for. The quiescent current of the nice!nano is around 10 microamps while the Aliexpress module is more than 140 microamps.
I now have a basic editor working and I can now hack all its software on the device itself. Hope to post a video of it soon.
-
I could not resist this PocketType keyboard kit from Mechboards when I saw it advertised at a very reduced price. I wanted to see if I could program it in Espruino as the sockets on the keyboard for a Pro Micro ATmega32U4 board are also compatible with a nice!nano board based on an NRF52840 processor.
When I got the kit, I realised that there were enough spare pins to drive a display - in fact two low power ST7302 based displays as can be seen in the photo below.
The top display in the picture is running a Bangle style launcher and the bottom display is a Terminal console. The bottom right key can be used to direct the keyboard output to an app running in the top display or to the console in the bottom display. In addition, the device can be made to appear as a bluetooth keyboard to another computer by running the keyble app.
The keyboard is powered by a rechargeable LIPO battery. The keyboard matrix scanner is activated by pressing any key and I was pleased that it starts fast enough to capture the first key press. The end result is that the overall standby current consumption is less than 100 microamps. The spare lipo battery I used is 1200mah, so with light use, I will next have to charge it again some time in 2025.
PocketType is a 40% keyboard with numbers and symbols accessed by using layer keys. The kit comes with blank keycaps which I have labelled with transfers and then sealed with clear nail varnish. The transfer set was for a standard set of characters - thus the creative use of orientation to label arrow keys etc.
With the addition of a simple text editor, the device is definitely a candidate for a deckchair/sun lounger programming tool - although it has to be said that typing on the microswitch based PocketType keyboard is thumb based and fairly slow.
-
I have been using the ST7302 low power display that I described in a previous post for a number of projects. Here it is being used for a continuous monitor and display of CO2 levels using a SCD41 sensor (see below). The display is driven by a Seeed XIAO BLE nRF52840 module flashed with Espruino.
The sensor is mounted below the circuit board in the picture of the prototype (top). The CO2 sensor also measures temperature and humidity.
Measurements are taken every 5 minutes and recorded every 10 minutes. The fully charged 800mah Lipo lasts well over two weeks.
Recorded measurements are displayed (see below) and can be retrieved using bluetooth. In addition, the current reading of CO2, temperature and humidity is included in the manufacturers data in the BLE advertising messages.
Measuring CO2 is a great way of telling how well ventilated a room is. Fresh air is about 420 ppm (up from 280 ppm in the year 2000!) and above 1000 ppm is a bit stuffy leading to drowsiness,
The monitor flashes a green led every 5 seconds when CO2 exceeds 1000 ppm, alternately red then green when the level is above 1200 ppm and red when the level is above 1400 ppm.
The code and more details can be found in my github repository here.
-
-
That works great - many thank s- I did not know you could access the hidden root that way!
I tried another version of the ST7302 driver which uses an image buffer in addition to the screen mirror buffer. This version only copies the updated part of the image buffer into the screen buffer put still blits the whole screen buffer in
g.flip
.This version reduces 550ms to 146ms which is much more useable and has better power consumption at the expense of the additional 4000 byte buffer.
The new version is in the repository here. I am sure the update function can be optimised using some of your bithack code.
-
The display background is not as white as an Epaper display but it is very clear and the background is similar to that in the original Kindle. It is not as "dull green" looking as the Pixel or old Nokia displays look in some lights. I do not have a Pixel so that is from photos!
The current code is useable in that it takes 550ms to draw the clock and widgets on the screen shown above of which only 10ms is need for the
g.flip()
call. Clearing the screen i.e.g.clear();g.flip()
takes only 30ms. So a lot of the time in drawing text is probably the Espruino interpreter calling the C setPixel() routine.I will try your ingenious code above to see if it works:-)
BTW: I want to try to see how using the screen as a Terminal might work. I have built a version of the PUCKJS firmware with the TERMINAL module but I cannot see a way to set the graphics instance that Terminal uses. It seems to assume it is built in. Is there a way of setting the instance from Espruino?
-
@Gordon I have not seen a bigger display for sale, however, I found this presentation from the manufacturer which refers to larger and even colour displays using the same technology.
Yes, the C -code is due to the odd layout - its sort of interleaved as well with bit 0 of a 24 bit chunk in one column and bit 1 in the next. There is a good write up here in Technoblogy where I noticed the display.
It would be great if the fill/setpixels code was included in Espruino in some way as it would make the driver much faster.
PS Very happy for the ST7302 module to be included in the Espruino module library although not sure how that works with embedded C.
-
Thanks,
Have not tried that one.
Thepixel.js
display is much lower resolution (128x64) and has a backlight so I think this would be a much better display for a Pixl.js V2!BTW. I am using HW SPI at 10Mhz to update the display which works well. I am thinking of trying to connect the display to one of my old NRF52832 watches to get the extra flash memory.
PS.I think the time display above may be adapted from some of your code - look familiar?
-
The 2.13" (250 x 122 pixel ) reflective display shown below connected to a Puck.js V2.1 has an ST7302 hardware driver. The display is similar to a Sharp Memory Display in that has no backlight and it permits much faster updates than Epaper displays.
It is also much cheaper than the Sharp displays - I got three from Aliexpress for less than 20 pounds (incl. postage and tax). Just search for ST7302 display.
In low power mode with frame refresh set to 4Hz, it uses on average 30 microamps. This is a versatile display, in that, in high power mode it can update at a 32Hz frame rate with current consumption still less than 1 milliamp.
The driver and example code can be found here
-
I will look for in my photos. I am afraid that I have gifted both the GW32 watches I had. @fanoush may have a picture as I am sure he has one.
Found this one due to @yngv126399:
-
Hi, Gordon rightly thought that switching between HW and SW SPI was a bit of a hack and that a more elegant solution would be to see if SPIFLASH code could use HW SPI when sharing SPI was necessary . I did not get round to looking at that and as @fanoush mentions, the HW/SW hack is not in the main Espruino repository.
-
-
-
-
-
This project was driven by the inconvenience of using SDR (Software Defined Radio) programs without having an explicit physical tuning knob to adjust frequency. Subsequently, I have found it also useful for scrolling with tablets.
The implementation uses an Espruino Puck.js and a rotary encoder as shown below in the breadboard prototype and the final device.
Connections are (Encoder -> Puck): GND -> GND, SW -> D28, ENCODER -> D29,D30.
The program below presents the Rotary Encoder as the middle wheel and button of a bluetooth mouse.
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; } function createSwitch(pinA){ pinMode(pinA,"input_pullup"); var OBJ = {}; function handler(ns){ OBJ.emit("change",!ns.state); } setWatch(handler,pinA,{repeat:true,edge:"both",debounce:25}); return OBJ; } //HID report for Mouse device var report = new Uint8Array([ 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7F, 0x75, 0x08, 0x95, 0x03, 0x81, 0x06, 0xC0, 0x09, 0x3c, 0x05, 0xff, 0x09, 0x01, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x02, 0xb1, 0x22, 0x75, 0x06, 0x95, 0x01, 0xb1, 0x01, 0xc0 ] ); NRF.setServices(undefined, { hid :report }); var ROT = createEncoder(D29,D30); ROT.on("change",(wheel)=>NRF.sendHIDReport([0,0,0,wheel,0,0,0,0],()=>{})); var SW = createSwitch(D28); SW.on("change",(sw)=>NRF.sendHIDReport([sw?1:0,0,0,0,0,0,0,0],()=>{}));
The encoder handler is adapted from here and I found it worked much more reliably than the Espruino encoder module. In addition the following code allows the device to switch from HID to normal Espruino mode for connection to the WebIDE i.e. hold down the encoder switch until the Puck flashes GREEN. On reboot or reset, it will go into HID mode by default and flash BLUE. On connection, there is a BlUE flash and a RED flash on disconnection.
pinMode(D28,"input_pullup"); E.kickWatchdog(); setInterval(()=>{ if(D28.read()) E.kickWatchdog(); },5000); E.enableWatchdog(10, false); function flash(pin){ pin.set(); setTimeout(()=>{pin.reset();},500); } function delayms(d) { var t = getTime()+d/1000; while(getTime()<t); } var STOR = require("Storage"); NRF.on("connect",()=>{flash(LED3);}); NRF.on("disconnect",()=>{flash(LED1);}); delayms(2000); if (D28.read()){ flash(LED3); if (STOR.read("main.js")) eval(STOR.read("main.js")); } else { flash(LED2); }
Promicro is a clone of the Nice!Nano so its the same board description.