-
-
@Gordon
There has been slow progress with the project.However new year and its my intention to make further progress with this project. I want to design the next version which is to be compatible with the new Pico.
Would it be possible for you to create an Eagle part for the new Pico so I am able to get a head start for when it arrives?
-
-
If you overload a supply the voltage will start to fall. The reason the Espruino resets is that the in-rush current for the relay coil is pulling down your supply voltage.
There are usually datasheets for relays with this information on.@lavamantis
I would suggest working back from what you are switching.- What device on the relay are you switching? i.e. boiler, heater, light etc.
- The voltage and current are you switching with the relay? i.e. the device load.
- How long are you switching the device on for?
The ULN2003 will switch up to 500mA. The relay you are using has contacts rated at something like 10A @ given voltages. As you can see this is a big difference.
Bi-stable relays or 'flip flop' relays switch the contact state each time you energise the coil. Again it depends what you are switching. If the power fails you need to make sure it fails to a safe state!
- What device on the relay are you switching? i.e. boiler, heater, light etc.
-
@lavamantis - It's nice to see you progressing with your project.
Depending on your specific project requirements it might be worth investigating alternative methods of switching the DC load. Using a standard relay might not be the most efficient.
If it has to be a relay, look into using a bi-stable relay. This only requires a quick pulse to change the contact state.
-
Just a quick update.
ALWAYS USE PROTECTION... I should have known better really but I got lazy and there were actual flames, but no injuries!!
Connected the 24VAC GND to the DC GND and it really does not like it when using a bridge rectifier.
After a small moment of panic and further investigation, it appears the only damage was the bridge rectifier, primary side rectifier PCB tracks disintegrated and the two tiny jumper wires I was using connected directly to the 24VAC transformer were the items that caught fire.
Most importantly the Espruino is still okay, its still relatively isolated being powered via USB at the moment.Next week I will replace the bridge rectifier with half wave rectification, use some protection on the secondary side of the transformer, make sure the wires are suitably sized and try again. In theory this should do the trick.
I have finished adding on all the input connectors and hooked up a thermistor bead on each input. They at least seem to be working just fine now.
Need to track down a 4-20mA sensor to test. I'm sure I had one kicking around!
-
-
-
I have been working for a while in some spare time to build my own controller for the use in building HVAC applications. I wanted to prove a few of the circuits so I squeezed as much as I could on a 10cm x 10cm board.
So this is very much just a proof of concept to check that the elements work.
SMD parts were soldered using a mini oven from Argos. I have to confess this is my first time using this method and on my first attempt I heated up the board too quickly which caused what can only be described as electronic popcorn.
The second time result is not perfect but a relative success. I set the temperature manually as required by the SMD paste temperature graph every 30 seconds.The board has five universal inputs, selectable as follows using the jumper adjacent to each input:
- Digital input.
- Current 4-20mA input. Note that loop to be externally powered.
- Thermistor Input.
- Voltage 0-10vDC (Not PWM).
Four analogue outputs 0-10vDC (20mA max)
Four digital outputs via relays.
The board has a set of female headers on the back to plug the Espruino into. Note that my Espruino has the pin headers mounted in a downward direction.
I have tested some of the very basic functionality.
- Thermistor reading but not as stable as expected. Further investigation required.
- Only two of the analogue outputs are working correctly. Suspect this is down to the tiny resistor network components not soldered quite right.
- Only one relay soldered on so far but working.
- Digital input.
-
-
-
@DrAzzy - Added the console.log part as suggested.
This is what the console returns.>digitalRead(B9) =0 >init() [64,0] [0,0] =undefined IRQ State >digitalRead(B9) =1 >
-
I figured I must have sent the RFM12B module some commands that must have caused it to jump into life.
I have tried sending just the first two commands and then manually sending the rest. No luck. I have had a look at different uses in other projects, all wired the same way. No reset pin.
I had another go tonight, starting from scratch rewiring all over again but I'm back square one with the IRQ line just being triggered high as soon as I send
(0x0000)
.I tried just sending the first two commands
setWatch(function() { console.log("IRQ State"); // do next stuff }, B9, {edge:"both", repeat:true}); function XFER(cmd) { SPI1.send([cmd>>8,cmd], B8); } SPI1.setup({sck:B3,miso:B4,mosi:B5}); // setup SPI function init(){ XFER(0x0000); XFER(0x8205); }
-
WHAT THE HELL!!!! Its stopped working, I unplugged the board for some reason and then had to plug back in and reload the code and now it doesn't work.
This is what I have. I was simply running
spiInit()
and it was triggering the IRQ up and down.var C = { // maximum transmit / receive buffer: 3 header + data + 2 crc bytes RF_MAX : (RF12_MAXDATA + 5), // RF12 command codes RF_RECV_CONTROL : 0x94A0, RF_RECEIVER_ON : 0x82DD, RF_XMITTER_ON : 0x823D, RF_IDLE_MODE : 0x820D, RF_SLEEP_MODE : 0x8205, RF_WAKEUP_MODE : 0x8207, RF_TXREG_WRITE : 0xB800, RF_RX_FIFO_READ : 0xB000, RF_WAKEUP_TIMER : 0xE000, // RF12 status bits RF_LBD_BIT : 0x0400, RF_RSSI_BIT : 0x0100, // bits in the node id configuration byte NODE_BAND : 0xC0, // frequency band NODE_ID : 0x1F, // id of this node, as A..Z or 1..31 RETRIES : 8, // stop retrying after 8 times RETRY_MS : 1000, // resend packet every second until ack'ed }; var RFM_IRQ = B9; var SPI_CS = B8; var SPI_MOSI = B5; var SPI_MISO = B4; var SPI_SCK = B3; var nodeid; // address of this node var group; // network group var frequency; // Frequency within selected band var rxfill; // number of data bytes in rf12_buf var rxstate; // current transceiver state var ezInterval; // number of seconds between transmits var ezSendBuf = new Array(RF12_MAXDATA); // an empty array of length 100 var ezSendLen; // number of bytes to send var ezPending; // remaining number of retries var ezNextSend = new Array(2); // when was last retry [0] or data [1] sent var rf12_crc; // running crc value var rf12_buf = new Array(RF_MAX); // recv/xmit buf, including hdr & crc bytes var rf12_seq; // seq number of encrypted packet (or -1) var rf12_fixed_pkt_len; // fixed packet length reception var seqNum; // encrypted send sequence number var cryptKey = new Array(4); // encryption key to use //void (*crypter)(uint8_t); // does en-/decryption (null if disabled) function XFER(cmd) { SPI1.send([cmd>>8,cmd], SPI_CS); } function spiInit() { SPI1.setup({sck:B3,miso:B4,mosi:B5}); // setup SPI XFER(0x0000); // intitial SPI transfer added to avoid power-up problem XFER(C.RF_SLEEP_MODE); // DC (disable clk pin), enable lbd // wait until RFM12B is out of power-up reset, this takes several *seconds* XFER(C.RF_TXREG_WRITE); // in case we're still in OOK mode XFER(0x80C7 | (band << 4)); // EL (ena TX), EF (ena RX FIFO), 12.0pF XFER(0xA000 + frequency); // 96-3960 freq range of values within band XFER(0xC606); // approx 49.2 Kbps, i.e. 10000/29/(1+6) Kbps XFER(0x94A2); // VDI,FAST,134kHz,0dBm,-91dBm XFER(0xC2AC); // AL,!ml,DIG,DQD4 if (group !== 0) { XFER(0xCA83); // FIFO8,2-SYNC,!ff,DR XFER(0xCE00 | group); // SYNC=2DXX; } else { XFER(0xCA8B); // FIFO8,1-SYNC,!ff,DR XFER(0xCE2D); // SYNC=2D; } XFER(0xC483); // @PWR,NO RSTRIC,!st,!fi,OE,EN XFER(0x9850); // !mp,90kHz,MAX OUT XFER(0xCC77); // OB1,OB0, LPX,!ddy,DDIT,BW0 XFER(0xE000); // NOT USE XFER(0xC800); // NOT USE XFER(0xC049); // 1.66MHz,3.1V } setWatch(function() { console.log("IRQ State"); // do next stuff }, RFM_IRQ, {edge:"both", repeat:true});
-
That's weird. So I started again from scratch, hence the pulling all the wires out and making sure I had got the physical connections correct.
@TrapperBob, I tried swapping the MISO and MOSI but that is definitely not it. Definitely worth a try though!
I setup a setWatch on the IRQ pin to log to the console when the state changes (rising and falling).
Now when I send multiple commands I am receiving plenty of IRQ level changes on the console. I'm sure this wasn't working before and as far as I can understand this is proof that the Espruino is at least talking to the module and it is responding correctly??Looking at the Arduino libraries for the RFM12B, I think quite a bit of the code is related to some sort of software SPI. We don't have to worry about this on the Espruino :)
-
-
-
Progress...
function XFER(cmd) { SPI1.send([cmd>>8,cmd], B8); } var C = { RF_SLEEP_MODE : 0x8205, RF_WAKEUP_MODE : 0x8207, RF_TXREG_WRITE : 0xB800 }; function init() { // setup spi SPI1.setup({sck:B3,miso:B4,mosi:B5}); // then... XFER(0x0000); // intitial SPI transfer added to avoid power-up problem XFER(C.RF_SLEEP_MODE); // DC (disable clk pin), enable lbd // wait until RFM12B is out of power-up reset, this takes several *seconds* XFER(C.RF_TXREG_WRITE); // in case we're still in OOK mode while (digitalRead(B9) === 0) XFER(0x0000); // ... }
Okay so good progress.
If I load the above code thendigitalRead(B9)
the interpreter returns0
.
Run funtioninit()
CheckingdigitalRead(B9)
returns1
-
-
-
-
-
-
Unfortunately I don't have the appropriate kit. Ideally the standard DIY reflow oven project would probably be a useful example.
I do have an example project but its work in progress right now. I need to send the PCB gerbers off to SEEED. The only problem is when I open up the files I keep tweaking stuff ;)
Yes I can't see anything being used for 136years so I think we are safe LOL.
I am calling 'compute' from setInterval.
setInterval (function() { p.setInput(temp); p.compute(); }, 1000);
My Pico arrived through the letter box this morning. Good work Gordon with the delivery of the Kickstarter project.
This little project will now be alive again to roll into its second iteration after a great deal of learning from the first!
@LawrenceG I have sent you a PM.