Search found 1013 matches

by mnf
Wed Feb 01, 2023 11:08 pm
Forum: Flowcode V8
Topic: wav sounds with Arduino nano
Replies: 7
Views: 20344

Re: wav sounds with Arduino nano

Easy - but the tmrpcm library is doing a lot of the work.. It is how I did it as well, except no library - did you look at the above link - I used pin 11 for the output - this would need to be changed to pin 9 to allow the ad card to be read using hardware spi. Try modifying my code and I'll try and...
by mnf
Wed Feb 01, 2023 8:29 pm
Forum: Flowcode V8
Topic: wav sounds with Arduino nano
Replies: 7
Views: 20344

Re: wav sounds with Arduino nano

I did post a snippet of code here https://www.flowcode.co.uk/forums/viewtopic.php?f=10&t=1147&hilit=sound&p=6284#p6284 - although this read sound from an EEPROM chip - you might be able to get it to work from SD (speed is going to be an issue) The Arduino doesn't have any sound generation hardware -...
by mnf
Wed Feb 01, 2023 2:30 pm
Forum: Flowcode V8
Topic: wav sounds with Arduino nano
Replies: 7
Views: 20344

Re: wav sounds with Arduino nano

A board like the dfplayer is probably the easeist route?

Try https://uk.banggood.com/search/dfplayer.html?from=nav

It works very well - support is good and sound quality reasonable.

Martin
by mnf
Sat Jan 28, 2023 11:22 am
Forum: Flowcode V7
Topic: Strange ADC behaviour
Replies: 8
Views: 12531

Re: Strange ADC behaviour

Hi,

You need to use | (or) and & (and) to set or clear the relevant bits..

For example in C

Register |= 0b10; // Set bit 1
Register &= ~0b10; // Clear bit 1

Or more generally:

Register |= (1 << bit);
Register &= ~(1 << bit);

Where register is PORTA for example.


Martin
by mnf
Mon Jan 16, 2023 8:58 am
Forum: General Programming
Topic: using Arduino Library
Replies: 10
Views: 12903

Re: using Arduino Library

Hi Angelo, The Arduino libraries can't be used as is. Converting a library or creating a new component is a fair amount of work - but varies widely... What are you trying to use? As an aside - it is possible to use esp32 C code and add to an esp32 project. The same technique might be usab!e with oth...
by mnf
Sun Nov 27, 2022 8:39 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Wow - that is a noisy signal! Do you have any filtering on the line? I looked at the rc-switch library and it does use the pin change interrupt to record an array of timings. This is a difficult way to debug code :-( - I wonder if there is a way you can record / send an actual signal and then a way ...
by mnf
Sat Nov 26, 2022 7:29 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

A brief attempt at a version that 'ignores' noise. Again - remove the call to SendTest to try on hardware (I'd also remove the test of issim too - it's an extra branch and sped is good here) HC12 SIm.fcfx As an aside - rather than use 'pos' and a shift to add in a 'one' bit - it might be quicker to ...
by mnf
Thu Nov 24, 2022 10:49 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor, I'll think some on the noise handling over the weekend - one idea is to 'ignore' some pulses before attempting to read a message - for example 24 bits should have ~50 pin changes so ignore 250 pin changes to skip the first five messages (or so) then wait for a 'low' period. Do you know wh...
by mnf
Thu Nov 24, 2022 8:22 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor, Seems to simulate OK - note that as mentioned the 'noise' handling doesn't do anything yet. Add a breakpoint at start of PinChange to simulate. This should work on hardware if you remove the SendTest(value) before the loop. The 'action' is with 'ideal' timings shown and ignoring errors. C...
by mnf
Wed Nov 23, 2022 11:39 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

A version that allows simulation. HC12 SIm.fcfx I've modified to save the data received to a single long variable instead of an array and rearranged pin change slightly - it needs to be as fast as possible - imagine a transient 'pulse' in the middle of the long low - the 'up' change will register - ...
by mnf
Tue Nov 22, 2022 9:12 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor, I tried this - and no joy. Modded slightly and working again on my test rig. I think the issue is that there are several 'writes' to D2 - this will fire an interrupt and change the pin to an output (it needs to be an input) - seems to mess things up. Note the AVR chips don't have many pin...
by mnf
Tue Nov 22, 2022 12:26 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor. I'm not sure what you mean by " I have to change pin B5 to pin d2" . D2 is the interrupt pin for int0 (it is fixed) and we must not write to it - if a write changes the value it will fire the interrupt which is not what we want. It should be connected to the input from the sensor. Can you...
by mnf
Mon Nov 21, 2022 10:27 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Just had an idea for making this more 'robust' concerning noise. All the pulses are fairly long (350us+) - so if the pulse is less than a 'threshold' value (say 50us or 10us) then ignore it. This is easily done near the start of pin change with if pulse < threshold error_count = error_count + 1 else...
by mnf
Mon Nov 21, 2022 8:57 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor, The Arduino library works in a slightly different way (albeit rather more complicated): 1) Record a list of pulses high/low and their lengths for complete message 2) Decode the list of pulses. This means that multiple message protocols can be handled using a single data 'recorder' with a ...
by mnf
Sun Nov 20, 2022 11:43 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

Hi Viktor, Noise will certainly cause issues if it triggers an interrupt. It would be difficult to modify the code to work on a single direction interrupt - the length of a 0 and 1 'bit' are the same - so if measuring from rise to rise the total time (4 x 350us) is the same for either value. Pin B5 ...
by mnf
Sun Nov 20, 2022 2:25 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

I got things to read and write. I modded Iain's code slightly - to run on an ATTiny85 (it was to hand) as a transmitter - sending a number (incrementing) at 1s intervals. The chip I used is running at 16.5MHz (Digistump) - and timings were slightly fast using 'delays' when viewed on the 'scope. I ad...
by mnf
Sun Nov 20, 2022 1:33 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

I think the pin change can occur at >15Hz?

The 'info' at the bottom of the dialog is for 'Timer' interrupts and I think is just a red herring?

Martin
by mnf
Sun Nov 20, 2022 9:23 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

I think the timer component should be accurate enough - I posted some code that used a high resolution timer (with a bit of C to decode the j1850 protocol (see https://www.matrixtsl.com/mmforums/viewtopic.php?f=6&t=21641&hilit=cobvert+dutch&p=98331#p98331) but it's rather more complicated) but 350us...
by mnf
Sat Nov 19, 2022 9:54 am
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

We looked at a couple of ways of doing this: 1) Use a 'delay' icon (So if all delays are multiples of 350us - count the number of 175us delays occurring) 2) Use a timer - and start / stop the timer. The code is all based on looking at the times at pin change however. The interrupt on pin change (Ard...
by mnf
Thu Nov 17, 2022 7:17 pm
Forum: Flowcode V8
Topic: HC-12 433 mHz module + Ard + Kerui PIR
Replies: 94
Views: 440426

Re: HC-12 433 mHz module + Ard + Kerui PIR

As an aside - Jan and I worked on an IR remote decoder that used a similar message structure (although the timings are much different) It might be possible to modify this code to work with this - the time handling will need some work... See https://www.flowcode.co.uk/forums/viewtopic.php?f=3&t=1120&...
by mnf
Wed Sep 14, 2022 8:11 am
Forum: General Programming
Topic: Converting a program from Arduino to Flowcode
Replies: 4
Views: 10161

Re: Converting a program from Arduino to Flowcode

Answered in the Flow code forum...
by mnf
Wed Jun 29, 2022 10:52 pm
Forum: Freelance Embedded Engineers
Topic: SPWM (Sinusoidal Pulse Width Modulation) Programmer Needed
Replies: 7
Views: 22646

Re: SPWM (Sinusoidal Pulse Width Modulation) Programmer Needed

Good - progress! A couple of things you need: To access FC variables in C blocks - prefix them with FCV_ for global variables or FCL_ for local variables (and name is all uppercase - even if not so in FC) You haven't defined a lookup table - called lut1 in your C code in the interrupt handler. You h...
by mnf
Mon Jun 27, 2022 7:13 pm
Forum: Freelance Embedded Engineers
Topic: SPWM (Sinusoidal Pulse Width Modulation) Programmer Needed
Replies: 7
Views: 22646

Re: SPWM (Sinusoidal Pulse Width Modulation) Programmer Needed

The password doesn't seem to be correct...
by mnf
Mon Feb 21, 2022 8:39 am
Forum: General Programming
Topic: Compile Error (Arduino MEGA 2560)
Replies: 6
Views: 5635

Re: Compile Error (Arduino MEGA 2560)

Hi Brendan,

The problem occurs because of the use of USB_Serial. The Arduino Mega doesn't support it. You'll need to switch to usindg the UART component (which lets you send/receive data via the USB port too...)
Example_Arduino_ATmega2560_HEX_Compile_Issue.fcfx
(29.48 KiB) Downloaded 143 times
Martin
by mnf
Wed Jan 12, 2022 10:57 am
Forum: Flowcode V8
Topic: Decision with floating variable
Replies: 4
Views: 2625

Re: Decision with floating variable

Hi dagr.

Please could you post your code-- someone will be able to help you then...

Martin