Adventures with I2C & Minerva Mk2

Anything QL Software or Programming Related.
User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

XorA wrote: Tue Sep 09, 2025 2:46 pm
t0nyt wrote: Tue Sep 09, 2025 1:27 pm Damn, I now have 2 different devices using the same address ID and neither has the option to change the address ID :shock:
Time to learn about i2c muxes then :-D
I look forward to it!


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

t0nyt wrote: Tue Sep 09, 2025 3:40 pm
XorA wrote: Tue Sep 09, 2025 2:46 pm
t0nyt wrote: Tue Sep 09, 2025 1:27 pm Damn, I now have 2 different devices using the same address ID and neither has the option to change the address ID :shock:
Time to learn about i2c muxes then :-D
I look forward to it!
Well it _looks_ simple enough... have ordered a couple to have a play


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Looking at the CAD drawing for the Mk2 remake it doesn't look like there are any pull up resistors on the mk2 board

I'm wondering if the odd things I'm seeing with a couple of devices could be down to a lack of pull-up's?

Could I cause any damage by fitting a couple of 10k resistors somewhere between the mk2 and the i2c devices please?

I understand what they do to the i2c bus, but am not confident enough to just shove them in yet

Many thanks
Tony


User avatar
XorA
Site Admin
Posts: 1741
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Adventures with I2C & Minerva Mk2

Post by XorA »

No damage at all.


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

XorA wrote: Wed Sep 10, 2025 8:06 amNo damage at all.
Many thanks, will try fitting a pair just before the breakout board to see what happens then

Many thanks
Tony


User avatar
XorA
Site Admin
Posts: 1741
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Adventures with I2C & Minerva Mk2

Post by XorA »

Because you are using lots of flying wires you might be reaching the capacitance limit on the bus.

Time to learn kicad and get some PCBs :)


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

XorA wrote: Wed Sep 10, 2025 8:26 am Because you are using lots of flying wires you might be reaching the capacitance limit on the bus.

Time to learn kicad and get some PCBs :)
Maybe :shock:

But the devices in question (like 32kb) still play up when connected directly to bus on their own without the breakout


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Mind you, the device I have most trouble with has it's own pull up resistors on-board, so I may be barking up the wrong tree here (for now at least)

EDIT: the problem device is working now, was a slog though
Last edited by t0nyt on Wed Sep 10, 2025 2:12 pm, edited 1 time in total.


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Next up Text-to-Speech (DFROBOT Speech Synthesis Module)

This has an address ID of &80 (i2c_io &40) - which clashes with HTU21D Temp/Humidity, so to use both will need a mux (thanks XorA)

So far, for some reason that I'm looking into, I can only get the same female voice regardless of the [m] option setting

EDIT: it seems the device only has 1 voice looking at the forums (despite the IC data sheet specifying it being able to support multiple voices)

Downsides of this module (other than using &80) are that the "English" voice has a distinct Chinese twang (no offence!) and the built-in speaker is a bit "tinny" (improved by lowering the volume) so will be trying the audio out to my QL monitor when I get a chance.

This is a VERY basic test program, will eventually create a full library of the available functions and settings

The basic BASIC code

Code: Select all

100 c$=CHR$(164) & CHR$(HEX('AA')) & CHR$(255)
110 r$=I2C_IO(c$,0,HEX('40'),1)
120 c$=CHR$(1) & CHR$(188) & CHR$(255)
130 r$=I2C_IO(c$,1,HEX('40'),1)
200 PAUSE 50
500 t$="[x0][t5][v3][s6][m3][g2][h2][n1]This is a test of speech"
510 c$=CHR$(164)
520 c$=c$ & CHR$(HEX('FD')) : REMark command header
530 c$=c$ & CHR$(0) & CHR$(LEN(t$)+2) : REMark command length
540 c$=c$ & CHR$(1) & CHR$(0) : REMark synth text
550 c$=c$ & t$ : REMark text to speak
560 c$=c$ & CHR$(255)
570 r$=I2C_IO(c$,0,HEX('40'),LEN(t$)+5)
The device for those who haven't seen one before
IMG_5052.jpeg
Last edited by t0nyt on Wed Sep 10, 2025 6:42 pm, edited 3 times in total.


User avatar
t0nyt
QL Wafer Drive
Posts: 1186
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Next up BH1750 Light Sensor

This uses address &23 by default, but can be changed to &5C which I had to do as &23 is used by the TI LCD (though I've just remembered that I could of just changed the address on that. Doh. (of course the &5C clashes with the "phantom" address of the 32kb eprom so had to re-jumper that as well)

I don't have a light meter so can't validate the Lux reading, but the lux value increases/decreases depending on the light shone on it

The code

Code: Select all

100 REMark Perform a power on and clear last measurement for testing purposes
110 c$=CHR$(164) & CHR$(HEX('01')) & CHR$(255): REMark Power on to allow clear
120 r$=I2C_IO(c$,0,HEX('23'),1)
130 PAUSE 5 : REMark need pause after power up?
140 c$=CHR$(164) & CHR$(HEX('07')) & CHR$(255): REMark Clear Last Reading
150 r$=I2C_IO(c$,0,HEX('23'),1)
160 PAUSE 5 : REMark need pause after clear?
200 REMark Send Measurement request for One Time Hi Res Mode
210 c$=CHR$(164) & CHR$(HEX('20')) & CHR$(255)
220 r$=I2C_IO(c$,0,HEX('23'),1)
230 PAUSE 10 : REMark pause for about 200ms (120ms needed)
300 REMark Request Measurement 2 bytes
310 c$=CHR$(188) & CHR$(255)
320 r$=I2C_IO(c$,3,HEX('23'),2)
330 v=CODE(r$)*256
340 v=v+CODE(r$(2 TO 2))
350 v=INT(v/1.2)
360 PRINT v;" Lux"
The device
IMG_5056.jpeg
IMG_5056.jpeg (66.21 KiB) Viewed 30 times


Post Reply