trigger latching 3v relay with signal from HT12D - esp8266

I am sending a signal from an HT12E through an rf transmitter to an rf receiver then an HT12D. This all works fine and the data signal from the HT12D is sent to a CZH-LABS D-1022A(for filling a pool). The pulse triggers the relay on the CHZ so that works ok.
What I want to do is take the same pulse/signal from the HT12D and send it through a 3vdc regulator (it is currently at 5vdc) and then through an EC2-3TNU latching relay.
The relay would then turn on power to an ESP12E, which would connect to the wifi and send a message to ThingSpeak that the original signal was received and the pool filling relay triggered.
The problem is that even though the signal from the HT12D reads 3vdc and it lights up an LED light when the signal is received, it doesn't trigger the latching relay.
I am attaching a schematic to show the wiring of my project.
To summarize:
The 5vdc (converted to 3vdc) signal from the HT12D will light up an LED but won't trigger a 3vdc latching relay EC2-3TNU.
I thought I may be the size of the smoothing capacitor after the center tap rectifier, but if I connect the ESP12E up to 3vdc and the activate the signal the LED still lights up but the latching relay won't engage.
I am flummoxed! Can anyone think of why the latching relay isn't activated by the 3vdc signal? Could it be I need a larger capacitor? The latching relay works because if I tap it with a 3vdc lead it triggers. This has nothing to do with code so I'm not providing any. Although once the ESP12E is activated, connects to the wifi and uploads to ThingSpeak, the ESP is coded to turn on an output pin to activate the latching relays reset pin turning off the ESP until the next signal input.
Any suggestions to solve this problem or a work around would be greatly appreciated.
I can't create tags and one for HT12D or HT12E would really be helpful.

I got this figured out. Just added a transistor, diode, and resistor.

Related

ESP8266 External Interrupts

I need to publish state of a switch (1/0) to an MQTT broker. I am planning to put it to deepsleep since this is a battery operated application. Is there a way to awake ESP8266 from deepsleep using external interrupts?
When the state of the switch changes, ESP awakes and transmits switch state to MQTT broker. After that it again goes to deepsleep.
I found no information about external interrupts in ESP. As I got to know, only clock is ON during deepsleep and not sure whether my goal is feasible. If not, I would be glad if you can please suggest an alternative for this (using ESP).
Lakmal
Sure, see the discussion here, basically if CH_DP goes high the chip wakes up.
You can also try my solution here. I use one transistor to enable interrupt to reset after ESP wakeup from deepsleep.

Wake from dsleep on input

The device I'm creating reads a liquid flow meter and logs data to a WebAPI. Ideally it would be able to sleep in a low power state until there was activity on the sensor but I'm not sure how to work that out. Docs say the chip will wake on a falling edge on the RST pin, but I can't have it reset every time input occurs. Is there another way to wake it externally, without pulling reset low? Or I guess I need a relay or SSR that directs sensor input away from RST when the chip wakes (assuming that would happen fast enough to engage the relay before it got reset again?)

Multipeer Connectivity and data to send along the way

I am developing a platform game trying to make it as well for multiplayer using the IOS Multipeer connectivity. I am stuck/confused/do not know what is the best way to send messages between peers (mostly like 4 peers in the game). The game style is like fun run and I have 4 hero running and firing each other and stuff like that. The thing is that keeping the positions of the other players is pushing me crazy!!
Sometimes other players are positioned in the wrong position (keeping in mind all devices are with the same screen size). Is that because of the lag of connectivity. How much information I can send per seconds and what is the best way to manage data transferring?
Any idea/thoughts are appreciated.
The throughput of MPC depends mostly upon the connection. What I've seen as the biggest performance problem is when one of the peers has WiFi disabled. This forces MPC to communicate over bluetooth which is incredibly slow. I've seen it run 20x slower than MPC over Wifi.
You don't need to be connected to a WiFi network. Just enable WiFi on all of the devices and iOS will leverage shared WiFi networks or create its own adhoc network.
The second thing you want to ensure is that your peers don't invite each other. You can only have one inviter in your network. When multiple peers invite and accept connections the MPC network become unstable.
Third thing is sendData:(NSData *)data toPeers:(NSArray *)peerIDs withMode:(MCSessionSendDataMode)mode error:(NSError **)error. If you are broadcasting your packets to all peers in the toPeers: array AND mode is MCSessionSendDataReliable then MPC waits until all of the connected peers ACK the message before moving on to the next packet.
UPDATE: I did some testing with my own app and over WiFi and two devices I can put about 100kbps. I'm using an iPhone 6 Plus and an iPhone 5S.
UPDATE 2: Thinking more about your question, there are a couple things to keep in mind with MPC communications:
Do all of your sendData and didReceiveData calls on a background thread and have that thread update your position data in your model. Tell your viewController that updates are available with a delegate method or notification.
Keep your data packets small, but design them so an update received represents the current state of your player. This allows you to miss an update and not be completely out of sync -- "send player 1 moved to (10, 10)" instead of "player 1 moved by (1, -1)"
Number your packets and use MCSessionSendDataUnreliable. If you get a packet with an earlier number than the last one you processed, throw it away. If you follow the second guideline above, you won't need this packet.
If you follow Dan Loughney's suggestions, I think your best bet in debugging is to log the received coordinates from the other players. That should help you identify whether the problem is due to timing issues, misinterpreted data or something else.

iOS gamekit/bluetooth data streaming

I have a written a program using gamekit/bluetooth to transfer low quality video using compressed jpegs from one iOS device to another. I do already realize that gamekit/bluetooth should not be used for this purpose (for small chunks of data) but it does indeed work well streaming 15 low quality compressed jpegs/second with little to no latency.
The question I have is once I increase either the quality or frame rate from the iOS device sender to the iOS receiver, a lag or delay will occur and will no longer be real time. If there is a delay, I'd like somehow for the sending iOS device to discard frames so that the receiver can catchup or for the receiver to ignore the backlog queue.
In GameKit I have set the session mode to use GKSendDataUnreliable to see if it could help, but to no avail.
If delays occur, what is the best solution and correct approach to discard the frames (jpegs) so that the iOS receiver can then catch up back to real time? Would the sender need to stop transmission for a period of time or is there something that receiving client can do to discard the accumulating queue.
I've used NSStream before as well, and while using wifi allows for greater bandwidth, the same problem will still occur in terms of delays if too much data is being transmitted.
Thank you in advance for your help.
Could you not attach a timestamp to each jpg (time since epoch perhaps) so the receiving client will ignore all images that are not within a given timeframe.
Also you could have the receiving client respond back with simple acknowledgement packets indicating that a jpg has been received. If the sending client hasn't received an acknowledge packet within a given timeframe it discards all images it was going to send and starts from scratch.
With this solution if the receiving client falls X seconds behind the sender it will stop sending acknowledgement packets and discard all incoming data until the sender throws out everything in its queue and starts sending "live" frames again.

Why do I get packet loss when using GKMatchSendDataReliable?

I have a multiplayer iOS game, and I am sending data using GKMatchSendDataReliable. However, occasionally, the data packet is lost. I've checked on the sending end and I am not getting an error. I'm just not receiving it on the receiving in. It is intermittent, and I have NSLogs right at the beginning of my receive method, so I always know when I get a message.
Is GKMatchSendDataReliable 100% reliable? It seems like a waste to have to set up my own reliable data sending routines.
It seems that this only happens when one device is on Verizon's LTE network. I havn't tried any other cellular network. When using Wi-Fi only, not necessarily the same wi-fi, it works fine.
This happens to me too. It appears that while GKMatchSendDataReliable is oodles more reliable than GKMatchSendDataUnreliable (which loses about 2% of packets in my tests), GKMatchSendDataReliable seems to occassionally lose the first packet I send (immediately after connecting).
My users also complain that some data may be accidentally lost during the game. I wrote a test app and figured out that GKMatchSendDataReliable is not really reliable. On weak internet connection (e.g. EDGE) some packets are regularly lost without any error from the Game Center API.
So the only option is to add an extra transport layer for truly reliable delivery.
I wrote a simple lib for this purpose: RoUTP. It saves all sent messages until acknowledgement for each received, resends lost and buffers received messages in case of broken sequence.
In my tests combination "RoUTP + GKMatchSendDataUnreliable" works even beter than "RoUTP + GKMatchSendDataReliable" (and of course better than pure GKMatchSendDataReliable which is not really reliable).
Apple stated that this was a bug and fixed in iOS7

Resources